Raspberry Pi Zero I2C pull up + GY-521 - raspberry-pi

I'm trying to talk via I2C to the gyro sensor MPU6050 which sits on a GY 521 board. But i can't get the device being detect.
I tested another i2c device (EEPROM) and got the device address detected. So i guess it has to be a hardware problem.
As far as i could find out:
RPi has a 1.8k pullup resistor on SDA and SLC already on board
my GY 521 also has also a pullup resistor (2.2k) on each line on board
Could the resistors be the problem? A good resistor value in sum would be around 5k on each line?
(The wiring should be ok, there are a lot of instructions around the net and i've checked it multiple times. I use 5v on the GY521 since it has a voltage converter)
Any help appreciated!

The problem was bad soldering.
For the record:
Using the RPi pullups in combination with the breakout board pullups works for me.

Related

raspberry pi gpio or rs232 relay board for simultaneous output bit-map?

I really wanted at first an rs232 8-channel relay board that I could command devices to turn on/off with a command string.
All of the ones I found online have the same deficiency in functionality for me: you can't set a subset of relays at the exact time. I can set relay 1 on, and then relay 7 on afterwards, I can set all 8 relays at once, but there is no command structure to pick out the exact leds I would like to turn on/off.
In the past I have dealt with hardware that had a bit-map of the IO pins, and a bit-map of the states and would apply all 8 settings at once. here are some examples:
to set pins 1 and 7 to on and the other pins off (8-bit binary bit-mapping,) send the following byte: in binary: 0100 0001b
to set pins 1,2,3,6 to on and the other pins off (8-bit binary bit-mapping,) send the following byte: in binary: 0010 0111b
I couldn't find any such device to do this so I thought I could make one with a raspberry pi using a simple 8-channel relay board, something like this:
https://www.amazon.com/SainSmart-101-70-102-8-Channel-Relay-Module/dp/B0057OC5WK
but on a Raspberry Pi, I'm running into the same issue: I don't see a way to set the gpio pins as a block command, only individually setting them in a for loop. I looked all morning and can see things like gpioctl, and mmio, but I can't put it all together to a simple proof of concept program on a testboard, any help would be appreciated.
I would really like a solution in C or scripting,
Thanks,
jleslie

Raspberry Pi - How to measure 2 resistor values with GPIO

Is it possible to measure 3 specific resistor values by using GPIO / Without using a full ADC setup?
I have an alarm sensor that I want to hook up to my GPIO. This sensor has 3 specific resistors value, based on it's state:
1) Normal - 4k7
2) Alarm - 9k3
3) Tamper - infinite.
Due to long lines, I would prefer 12V power on one side.
I would like to be able to detect these states by 2 normal GPIO input pins.
Is that even possible? What would be the schematic needed for this?
Or is the only solution to use (external) ADC's?
I am thinking about a voltage diver with resistors and a 1N4148 diode to clip it to 3v3. But so far my results are unfruitfull.
Thanks.
The problem here is you have three levels to measure. If we had two we could use a simple resistor divider setup to make (say) the 4k7 and 9k3 outputs on the sensor to logic 0 (<=0.8V) or logic 1 (>=1.3V) on a single GPIO pin. We could do this on two GPIO pins if we had two "independent samples" of the sensor output rather than one.
Given the above it is possible to design some simple logic network to do the comparisons but as the other comment mentions you're off into the realms of electronics.
ADC is the simplest way to go if you want to stay in the software domain. The are other SBC devices e.g. ESP8266 which have onboard ADC functionality and built-in Wifi https://esp8266-projects.org/2015/03/internal-adc-esp8266/ or you can hook up an add-on ADC to the Rpi for example https://learn.adafruit.com/raspberry-pi-analog-to-digital-converters
Good luck

pca9685 and node mcu using micropython

I have a Lolin MCU like this Lolin v3
I have a PCA9685 board like this cheap controller
And Im coding in microPython in the nodeMCU device. I managed to attach one of those small 9g servos to the nodeMCU board and controll it. No problem. I want to use a controller since I need more servos, so I connect the PCA like this:
PCA V+ <--> 3v3 in the mcu (5v produce no changes)
PCA GND <--> GND in the mcu
PCA SDA <--> SDA (Pin 4) in the mcu
PCA SCL <--> SCL (Pin 5) in the mcu
PCA OE <--> GND, V+ or open. Makes no difference
Now I downloaded this PCA9685.py and Servo.py from this web microPython PCA controller
I create an I2C like this
>>> i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4))
>>> i2c.scan()
[64, 112]
So the device is there. The cables are good, the i2c is working. But the servos won't move no matter what. Not even buzz.
I try moving the servo using
servos.position(1, us=1500)
no thing happened.. I connected several servos in several ports to make sure is port 1 not port 0 and those stupid errors.. nothing.
This is the code I'm running at the device right now:
from machine import I2C, Pin
import servo
servos = servo.Servos(I2C(scl=Pin(5), sda=Pin(4))
for i in range(16):
servos.position(i, us=1500)
Any clue ???

Interfacing ds18b20 with raspberry pi

i have a raspberry pi connected with two ds18b20 temperature sensor.
-sensor1 is fixed on the outside of my garage (distance 20m from raspberry pi)
-sensor2 is just connected in a breadboard near the raspberry pi.
Everything is working well.
I decided to add sensor3 located outside and from 20m from the raspberry pi.
Now when i type :
cd /sys/bus/w1/devices
if find this:
c0-40a000061005 c2-246056869800 c2-247056869000 d0-008000001000 w1_bus_master1
instead of :
28-.....
28-.....
28-.....
each sensor ref should be start with 28-.....
what is happening with my sensors?
If unplugged the sensor1, then everything is well
if i unplug the sensor3 and let only sensor1 and sensor2 everything is well.
Which modification do we have to do when sensor are located far from the raspberry pi?
thank you
That means that the 3rd sensor doesn't have a 4.7kOhm or 10kOhm resistor between VCC and the OUT wire (black/red one if you have 4wire DS18B20).
Just connect that resistor and it will work , I had the same problem . I spent weeks to find such an easy solution. And if you get the same code after you connected the resistor , that means you didn't connected it properly.Hope will help you

Connecting an accelerometer to a microcontroller pull up voltages

Im trying to connect a MMA852Q accellerometer to a 18F2550 microcontroller. According to accellerometer datasheet i2c clock and data lines would not tolerate voltages more than 1.6- 3.7 (+0.3). Those lines have to be pulled up to 5v for microcntroller to work. Im new in to this subject and your advice to overcome this issue would be really helpful.
You could look for "I2C level shifter" for attaching buses with different voltages together.
NXP appnote 10441 (pdf) has a very neat generic one, for example.