Seeking help with pi + LAMP + arduino for robotics, please


4 posts
by i-make-robots » Fri Jul 05, 2013 6:13 pm
Hi!

Thank you for taking the time to read this
I'm looking for help on a small project that would benefit a lot of pi robot fans. If you could please help, it would be great.

Opportunity
The worse part of building my robots is the human interface. I need an easy system everyone is familiar with. That's why I'd like to run my robots from a web-based UI: the software stack is mature, available on any device with a browser, and people get it.

My pi has a LAMP stack and I can send messages to the pi by using something like PHP's exec("echo \"some message" > /dev/ttyACM0");

Problem
1) PHP can't keep a connection open. Every time it opens a connection the arduino resets.
2) PHP can't receive messages from arduino. Important data for the user may be lost.

Solution
What I need is a daemon that maintains the pi/arduino connection and buffers human-readable commands messages both directions.

Arduino would send a ">" to indicate "I'm ready for more data".
Arduino would expect messages terminated with a semi-colon, because "\n" is not reliably delivered.

I don't know exactly what the returning messages look like (eg what format). I don't know exactly how the LAMP stack talks to the daemon. These two issues are interconnected. I'm interested in your thoughts.

Ideally this would be something open source and free to all.

Does such a thing already exist? Is there a simple way to solve this I'm not aware of?

Thank you!
Posts: 7
Joined: Mon Jun 24, 2013 2:40 am
by i-make-robots » Sat Jul 06, 2013 7:06 pm
Well... so far I've got pyserial + python-daemon + python-mysqldb.
By that I mean I've got the lego blocks, now I'm trying to fit them together.
Posts: 7
Joined: Mon Jun 24, 2013 2:40 am
by i-make-robots » Mon Jul 08, 2013 6:47 am
http://wp.me/p3z2rc-zJ is my progress so far. I feel I'm making good progress but I could be barking up the wrong tree. Anyone got a hint for me?
Posts: 7
Joined: Mon Jun 24, 2013 2:40 am
by i-make-robots » Mon Jul 08, 2013 11:59 pm
Seems I got it working, so I updated the contents of the last link. Enjoy!
Posts: 7
Joined: Mon Jun 24, 2013 2:40 am