Page 274 - Hacking Roomba
P. 274
Chapter 12 — Going Wireless with Wi-Fi 255
Going Further with LAMP
The M part of LAMP hasn’t been touched on yet. The preceding PHP script shows the basics
of how to receive sensor data, but the script doesn’t do anything with the data besides printing
it. With PHP and MySQL it’s pretty easy to record the sensor data to a database table. With
enough sensor data you can do an analysis on it to figure out things like:
When is the house the dirtiest? Compare historical dirt sensor readings with time
and date.
Approximately how big or cluttered is the living room? Average out time between
bump sensors to determine the mean free path of your rooms.
How long are my walls? Analyze the wall sensor readings to find walls; then create a
histogram to find the different wall sizes.
How long does it take for the dustbin to fill up? Average the time from when the
Roomba starts to when the vacuum motor over-current bit is set.
Collect enough data, and you can determine a great many things about the environment within
which Roomba moves. Roomba may not be a very accurate sensor platform, but its sensors
cover the same area again and again. Good data can often be recovered from noise with repeated
measurements.
Summary
A Wi-Fi Roomba coupled with a LAMP application is pretty powerful. You can create not just
web pages to control the robot, but dynamic database-driven web pages. Having the ability to
tie a database into the robot enables you to create for an entirely different level of interaction as
Roomba can now have a huge historical memory. You could create complex robotic logic based
on this elephantine memory located on a server anywhere and remotely command one or sev-
eral Roombas simultaneously. Or you could create a social networking site for Wi-Fi Roomba
users and collect real-time Roomba stats from all over the world.
As the price of the Wi-Fi modules continues to fall due to cell phones and portable game sys-
tems having Wi-Fi, making a Wi-Fi Roomba will become even more attractive. To make the
extra cost of the current devices more palatable, you can hook up the extra serial port offered to
the microcontrollers discussed in the next chapter. Then you can get the best of both worlds:
localized computation backed with a huge storehouse of previous knowledge.