Don
Raspberry Pi with Node.js and Arduino
by Alexandre Alapetite on 2012-06-23;
updated on 2012-06-24
Raspberry Pi with Node.js and Arduino
Can Arduino and Raspberry Pi be friends?
Live demo (not always running… Backup link)
Introduction
I had an Arduino Uno R3 together with the
Arduino Ethernet Shield R3,
but I never got the Ethernet Shield to be stable over several days,
even for my simple temperature project.
Enters Raspberry Pi, a tiny inexpensive (~27€) single-board computer that runs Linux,
is stable, cheaper than the Arduino Ethernet Shield alone (~32€),
and only slightly more expensive than an Arduino Uno (~22€).
On the other hand, to interact with the physical world, the Raspberry Pi only has some unprotected digital GPIO pins,
not safe for a software guy like me.
Few extension cards are available so far for the Raspberry Pi, they can be more expensive than an Arduino Uno,
and they do not have the same amount of libraries and community as Arduino.
The idea: combine Raspberry Pi for the high-level software with Arduino for the lower-level electronics, through a simple USB connection!
Furthermore, I want the Raspberry Pi to have an ultra-light Web server that can both be event-driven by the Arduino and send requests to the cloud.
My selection: Node.js.
Content
Introduction
Content
Architecture
Preparing the Arduino
Preparing the Raspberry Pi
Preparing Node.js
Architecture
[Raspberry Pi / USB / Arduino]
I use a Samsung USB tablet charger ETA-P10X (5V, 2A) to power the Raspberry Pi, which is also connected to the Internet via an Ethernet cable,
and to the Arduino Uno via USB.
The Arduino is connected to a solderless breadboard for simple temperature measurement (not detailed).
The Arduino Ethernet Shield is not used anymore.
Index
Preparing the Arduino
In the spirit of Node.js being event-driven and in order to save energy,
the Arduino sleeps most of the time and when it wakes up (here, every 5 minutes),
it sends some text that generates an event in Node.js.
With Node.js native language being JavaScript, it makes sense to send data from the Arduino to the Raspberry Pi
using JSON text strings.
The following Arduino program is meant to measure two different thermistors
(Temperature sensor with steel head)
in order to report the temperature inside and outside.
It is outside the scope of this document to explain the electronic details,
as the focus on the interaction between Arduino and Raspberry Pi.
Read More...
http://alexandre.alapetite.fr/doc-alex/raspberrypi-nodejs-arduino/
- Raspberry Pi with Node.js and Arduino - Using the Raspi as an Ethernet shield
- Using the Raspi as an Ethernet shield - Hack a Day
- Raspberry Pi with Node.js and Arduino
- Debian “wheezy” public beta | Raspberry Pi
- Température - Alexandre Alapetite
- node.js
- Temperature - Arduino - Raspberry Pi
- Arduino Ethernet Shield - SparkFun Electronics
- Doctor of informatics - Alexandre Alapetite
- Doc’ Alex - Alexandre Alapetite
- getusermedia: Getting access to local devices that can generate multimedia streams
- HTML5 webcam demo with getUserMedia()
- Personal software - Alexandre Alapetite
No comments:
Post a Comment