-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arduino MPU6050 #239
Comments
By the end i solved my problem in another way for get the values in go: 1.: Adruino Uploaded the MPU6050 RAW Example package main import ( ) func main() {
} OUTPUT: cX = 16824 | AcY = -164 | AcZ = -1284 | Tmp = 24.11 | GyX = -669 | GyY = -91 | GyZ = -150 |
UPDATE: In Release 8.2 the MPU6050 Driver is Broken. In Version 8.1 it works more or less, the Values are not refreshed, after removing in github.com/hybridgroup/gobot/platforms/i2c/mpu6050_driver.go this part:
All looks fine and i have all my values. Later i will make a diff between 8.2 and 8.1 to see what is broken and why. Maybe for the moment it is helpfull for other users. |
Hi, @sgilani Can you please try this code in substitute for the
Please let me know if that works for you! |
HI deadprogramm, thanks for help, this is the result after implentation, no values. Accelerometer {0 0 0} |
Maybe also helpful for debuging: This freezes the values: h.adaptor().I2cWrite([]byte{MPU6050_RA_PWR_MGMT_1, but when i remove just MPU6050_RA_PWR_MGMT_1 so the part looks like this: h.adaptor().I2cWrite([]byte{ I get again refreshed values, but some are missing: Accelerometer {20268 -120 14648} Gyro part 3 and Temp are lost somewhere... really strange |
Solved for v.8.1, change this const MPU6050_PWR1_SLEEP_BIT = 6 to this const MPU6050_PWR1_SLEEP_BIT = 0 then we can also use the setSleepEnabled part without troubles, to get the right values: Accelerometer {16472 -680 1772} |
According to the MPU6050 docs I could find: Get sleep mode status. Setting the SLEEP bit in the register puts the device into very low power sleep mode. In this mode, only the serial interface and internal registers remain active, allowing for a very low standby current. Clearing this bit puts the device back into normal mode. To save power, the individual standby selections for each of the gyros should be used if any gyro axis is not used by the application. So perhaps, a better thing would be to add a new constant |
You are right and i like your idea :) i will change it and share it. |
Hi, @sgilani did you ever have a chance to work up a PR with this? :) |
I get only back this when i run the Go Prog. on Windows, i checked the Adress with I2C Scanner for Adruino and i get back 0x68, some where the communication is broken.
Plattform Windows 8.1 & Adruino Mega 2560 and the RX/TX Light are On on the Board when i run "go run test_mpu.go", COM Port is set to 57600.
Connection: Adruino to MPU6050 (Not Sparkfun Version)
ADRUINO - 5V to MPU6050 VCC
ADRUINO - GND to MPU6050 GND
ADRUINO - SCL 21 to MPU6050 SCL
ADRUINO - SDA 20 to MPU6050 SDA
Any ideas?
Accelerometer {0 0 0}
Gyroscope {0 0 0}
Temperature 0
package main
import (
"fmt"
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/firmata"
"github.com/hybridgroup/gobot/platforms/i2c"
)
func main() {
gbot := gobot.NewGobot()
firmataAdaptor := firmata.NewFirmataAdaptor("firmata", "COM4")
mpu6050 := i2c.NewMPU6050Driver(firmataAdaptor, "mpu6050")
work := func() {
gobot.Every(300*time.Millisecond, func() {
fmt.Println("Accelerometer", mpu6050.Accelerometer)
fmt.Println("Gyroscope", mpu6050.Gyroscope)
fmt.Println("Temperature", mpu6050.Temperature)
})
}
robot := gobot.NewRobot("mpu6050Bot",
[]gobot.Connection{firmataAdaptor},
[]gobot.Device{mpu6050},
work,
)
gbot.AddRobot(robot)
gbot.Start()
}
The text was updated successfully, but these errors were encountered: