8

I have an arduino uno that needs to respond to an iOS application with the internet being the medium. My initial plan was to use a wifi shield for the arduino, but since I can't get one at this time, I figured I could just use a raspberry pi that is connected to the internet to control the arduino. I'm assuming this is possible?

I need to have the raspberry pi respond to a web server and send a signal to the arduino. Is this possible, and if so, can someone give me some advice on how to go about doing this?

3

Im actually working on a similar project right now. Its a simple web controlled R/C Car. I was in the same boat as you, I originally wanted a wifi shield for my arduino. But I settled on using a raspberry pi hooked up to my mega 2560 via USB. You should look into running the firmata protcol on your arduino. It comes with the Arduino IDE. Just look under File->Examples->Firmata and upload the StandardFirmata to your board.

The next step I took was running a node.js webserver with the firmata and socket.io node packages. I have recently began experimenting with the johnny-five node.js package. Simply because Im a bit of a noob when it comes to node.js programming, and was having issues getting it to work right with just the firmata node package. Johnny-five seems promising and I've had a bit of luck with it, but my code is still in the works. Ill post a link to my github page so you can at least have a reference (motor_test.js and motor_test.html, just keep in mind, its still non working code. I have successfully been able to control a led, but motors are a different story. If i get time today ill post my code to my working LED control through node.js project.

Anyway I know I couldn't provide a completely working solution for you, but I hope this at least gets you going in the right direction. Feel free to email me anytime (messyfresh@gmail.com) I'd love to help more in any way I can.

Here are the references. Just Google them. I cant post more than 2 links.
Install Node.js on RPi(http://joshondesign.com/2013/10/23/noderpi)
My github page (https://github.com/messyfresh/pi_rc)
Firmata
Node.js (I found the best version to use with socket.io and firmata is 0.8.2x)
Socket.io
Node.js Firmata
Johnny-Five Node.js

3

I very recently accompished this with node-serialport.

The following link explains a good strategy for full control over the Arduino.

Edit: someone edited and added a link for me :)

My Solution

Check out arduino/serial.ino, pi/server.js and pi/views/profile.ejs. Server.js opens the serialPort and a socket with profile.ejs. When something happens on the profile.ejs it triggers serialPort.write( buffer, encoding ) in server.js;

Just an FYI by default the Arduino Uno resets when a serial connection is opened. If you try and send data without waiting a second or two after the serial connection is opened, it will fail. I found that this problem resolved itself when I required human interaction to trigger serialport.write(). Another solution can be found by googling DisablingAutoResetOnSerialConnection.

Hope this helps!

@bobbyg603

  • you should add in your comments which github project you are refering to, then the OP can have a look – kolin Apr 9 '14 at 11:16
3

The simplest way would be use the hardware UART (disable console on Pi first) on both devices. When configured at 115kilobaud you can transmit allot of text data, like JSON but even binary data like zips, jpgs can be handled. It is recommended to start with lower rates first because some libraries have issues at higher bauds.

You can then write wrappers on the Pi in any flavour you like: C, PHP, Java, .NET MONO, Perl or Python.

This is an option for lightweight library that you can build up you self and there are an abundance of articles on how to do this on Arduino and Raspberry Pi.

1

We developed a small php daemon that connects to and wraps a remserial daemon (Uart-to-TCP-Socket). It can easily be extended to do additional tasks like connecting to a web server and send some data.

The daemon comes in a package together with a complete WEB UI to control an Arduino like board called CoPiino.

Let me know if you need support extracting the daemon.

Some project infos can be find here http://www.copiino.cc

protected by Darth Vader Jan 27 at 10:29

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.