G+_Benjamin Breüner Frost Posted April 27, 2015 Share Posted April 27, 2015 Is there a know it all that can answer me on how well electronics for the arduino plays with Raspberry pi? I want to start playing around with robotics and it seems like most electronics, like sensors and motor controllers, that work for the arduino works with Rasp pi, but i want to be sure. so i hope someone can help. Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 27, 2015 Share Posted April 27, 2015 A lot of the Arduino components are 5v logic and the Raspberry Pi has 3.3v GPIO pins. It really just depends on what the electronics need though. If you're just sending voltage, 3.3v should count as a "high" for most electronics. The danger comes when you have to read a high from 5v which would likely damage your Pi. Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted April 27, 2015 Share Posted April 27, 2015 Yes, sensors made to work with either board can be mixed and matched with either Arduino or Raspberri Pi boards. When you want to use lots of sensors, the "normal" thing to do is use an Arduino to interface with the sensors and a Raspberri Pi connected to the Arduino to control everything. I have a couple sensors and LED blocks along with an Arduino UNO and a Raspberri Pi B. All the sensors and LED blocks work with either board. Making the Arduino and Raspberri Pi communicate can be done over a Pi's usb, using one of the sensor pins on either board, or with the i2c bus (I think you might need some additional bits to use the i2c bus tho, haven't tried that one myself.) Using both a USB connection and a bus connection between the two devices can really give both boards a lot more functionality than they would have by themselves. The Arduino's can't store a very large program, but with a Pi connected to the usb port you could automate flashing the Arduino's flash. Using a bus connection between the two would be better for things that are more time dependent, or if you just don't want to be hassled with making the Arduino act like flash memory (it can be done, but it's slower.) Just as a quick example, say you have 2 temperature and humidity sensors and 6 water sensors in a room. You could connect all those to an Arduino easily, while with the Pi you would need to use some sort of bus powered sensors (much more expensive). The Arduino would just keep looping, reading each sensor and sending out a code via the communication pin to the Pi when it finds a high/low temperature or water presence in the room. The Pi could then update an Apache web server and send out email and text as needed. Yes, I'm planning on doing this for our server room at work. The dedicated devices cost $200 for the monitoring box then more for each sensor you want. It's also not important that someone fix things immediately should something go wrong. An hour of my time and $80 for hardware is much cheaper. Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 27, 2015 Share Posted April 27, 2015 I agree with Travis Hershberger? and was going give the same Pi+Arduino suggestion and for all the same reasons - just didn't want to take the time to type it all out ? I'm really curious about the i2c bus option for connecting the two together. I think it would be better for some things and certainly worth looking into, but I think you'd have to use a logic level converter to handle the 5v vs 3v3 problem - unless you used one of the Arduinos that use 3.3v logic. Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted April 27, 2015 Share Posted April 27, 2015 Ben Reese It's been quite a while since I had the two talking to each other, but the coms from the Pi's 3.3v used with a 10k pull-up resistor seemed to work well and be about as simple a solution as you can get. edit: Either way I was playing with the chance of releasing the "electronic smoke" by not using a diode to keep the current flowing in only one direction. Thankfully I didn't make a programming oops and avoided the magic smoke. Link to comment Share on other sites More sharing options...
G+_Benjamin Breüner Frost Posted April 27, 2015 Author Share Posted April 27, 2015 thanks, it helps a lot. but there is something that i don't quite understand. you say the rasp pi use 3.3v but for what i can see gpio pin 2 is 5v. is that the only pin using 5v? Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted April 27, 2015 Share Posted April 27, 2015 Benjamin Frost I'm probably reversing the Pi and Arduino. One of them uses 3.3v and the other 5v. Lysdexia hurts at times. Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 27, 2015 Share Posted April 27, 2015 The Pi logic circuit runs on 3.3v but it takes 5v to power it. That 5v pin is connected to the source power from USB. You can also supply 5v to that pin to power the Pi. Link to comment Share on other sites More sharing options...
G+_Eddie Foy Posted April 27, 2015 Share Posted April 27, 2015 adafruit (and I'm sure sparkfun) carry level shifters. The adafruit ones I got/looked at had a compromise. The bi-directional ones were kinda slow, but gave flexibility. The one-ways were faster but you locked in your design. I can't comment on the arduinos. They came after my time. I cut my teeth on the 8051/68HC11's and PICs. Settled on the PICs and have the tools for them. I love the little 8 pin ones for simple tasks. Surprisingly they have a great selection of peripherals. But the big honkering 40pin+ ones give you pretty much everything. Link to comment Share on other sites More sharing options...
G+_Travis Hershberger Posted April 27, 2015 Share Posted April 27, 2015 Eddie Foy All the Arduino boards are, are the same processors you already use, but with a very simplified software stack. Basically, you write a "scetch" (c program really), and push the button to load it onto the Arduino and have it run. All the drivers and communications software is built into the programming environment. Link to comment Share on other sites More sharing options...
G+_Eddie Foy Posted April 27, 2015 Share Posted April 27, 2015 Travis Hershberger Nope. Ardunios use Atmel chips (and ARMs), not Microchip PICs. (think PowerPC vs Intelx86) My ICE & ICDs will not work with them. Plus I like bare iron. No extra frills taking up unused PCB space. Real uControler programers use ASM. :P Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 28, 2015 Share Posted April 28, 2015 Eddie Foy? it looks like the 68HC11 is up to 4 Mhz? The Arduino Uno is 16. Even if half the clock cycles are taken up with frill, you still have more processing available. Once the chip is programmed, it can be removed from the circuit board and put on your own. I'll be honest though, I really don't know much about either chip or how they compare in real use. Link to comment Share on other sites More sharing options...
G+_Ben Reese Posted April 28, 2015 Share Posted April 28, 2015 So, I was thinking about the logic level shifting for i²c. Could you use a voltage divider coming from the 5v side? I don't know what kind of resistors you'd need for that - maybe a 10k to ground and 2×6k to the Pi? It would divide the voltage going from 5v to the 3.3v, but what would happen to the current going the other way? Would it also be divided? Would something like this be fast enough for i²c or would the resistors slow things down? Link to comment Share on other sites More sharing options...
Recommended Posts