Sending data from MPU6050 via UDP broadcast.
Connection of MPU6050
ESP12 — MPU6050
GPIO4 — SDA
GPIO5 — SCL
GND — GND
3V3 — VCC (not optimal. It would be better to bypass the voltage regulator on the MPU6050 board)
I manually had to remove the
#include avr/pgmem.h in MPU6050.h and include
Wire.begin(4,5) in my script. BTW: I am using an outdated library. Maybe the current version works out of the box.
With udpreceiver.py on my PC I get all packets sent by ESP12. The sampling interval is mostly 2ms. My laptop loses a few packets. In the production code the values should be transmittet binary with a fixed format and size.
Creating a stream with the values of internal ADC also works. But I need to add at least a delay of 3ms in the loop. Even then touching the ADC pin with an antenna-like metal or maybe something loaded with charge causes a hangup. I found the occurence of this hangup can be deminished by adding pullup resistors to CH_PD and REST. Maybe I should add some small capacitors there. Anyway with a delay of less than 3ms the module still hangs after a few seconds. But the ADC seems to be capable of faster sampling rates. No dupe (e.g. doubled) samples even with 1ms delay.
Edit: What I found concerning the pullups is alread described here. They also say, that a 100nF blocking capacitor should be added to VCC.