• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Arduino with RasPi Data Exchange

 
Ranch Hand
Posts: 10191
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone tried this out? I'm built my Arduino to sense any thermal changes and trigger an alarm. I want to connect my Arduino to the internet and since I already have a RasPi with a WiFi dongle on it, I thought of connecting my Arduino to the RasPi where I could get the data and expose it as a WebSocket end-point!

It looks like there are a couple of ways to do connect my Arduino with the RasPi, the easiest being the USB connection. Is there any other alternative? At the moment this is just one signal that I'm interested in. Later I'm planning to add a temperature sensor, motion detector sensor and a couple more. I want all those signals to be sent out separately to my RasPi each of which will be exposed as a WebSocket end-points that can be connected by a client. Any thoughts on how I could go about making the connection between my Arduino and RasPi?
 
Bartender
Posts: 2653
18
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use i2c, and program your Pi as master, Arduino as slave.

The code to make your Arduino a slave reader is available here:
https://www.arduino.cc/en/Tutorial/MasterReader
Don't forget that for i2c you need to provide pull-up resistors.
 
Joe Harry
Ranch Hand
Posts: 10191
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would that compare to just using a USB cable and connecting my Arduino with the RasPi? I mean using the serial port?
 
Jan Cumps
Bartender
Posts: 2653
18
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whatever works for you

i2c is a chip to chip serial protocol. So it's intended to make ICs talk to each other. USB is universal serial bus. If you can make that work, I think it's ok for you to use that.
i2c is on electronics level, USB is on computer level.

There's a number of communication standards in electronics. There are so many parameters that drive a decision.

 
Bartender
Posts: 20924
127
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there's actually a RasPi shield that piggybacks an Arduino. Connections between the 2 devices are fairly natural, since the Arduino has things like analog/digital ports built in. I have a project that would use USB to link to an XBee, which also has nice port options (plus wireless!)

It's possible that the Raspberry Pi might be overkill here, though. If you get an ethernet shield for the Arduino, it can be programmed to provide basic Internet services.
 
Joe Harry
Ranch Hand
Posts: 10191
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This library is what I'm considering to use. It combines reactive programming with Serial ports!

https://github.com/jodersky/flow
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!