Tuesday, February 22, 2011

ArduinoWorm on Hackvision

A week ago my Hackvision Kit arrived and as nootropicdesign promised on their site it really took less than an hour to assemble the board and start right off with the preloaded examples.




The board is an Arduino derivative which provides audio output and video output in PAL and NTSC. The graphics are drawn in black and white which really brings out the retro factor.

The board itself is designed like a typical controller and has onboard buttons which are used as a primary input. Additionally you have the possibility to connect a Wii Nunchuck adapter or self built paddles.

As I already mentioned the board comes with the preloaded all time favorite games "Space Invaders" and "Pong". There are additional games provided by other developers such as "Asteroids".

After enjoying the retro games for a while I decided to do my fair share of "game development". I implemented a game which was featured on millions of feature phones. I called it "Arduino Worm" to not get in trouble with the copyright ;). The principle of the game is simple. You have defined area in which balls are put at random locations. You control a worm eager to fetch those balls. There are two restrictions. The worm can not touch the area frame and it can not bite its own tail. If it does, you will see the two saddest words in gaming.

It is nothing fancy and there are still plenty of possibilities for improvement but I enjoyed programming an all time favorite game.








Here is a small video of the game in action:


video

You can find the source code on github. Feel free to modify, extend or improve the code.

Saturday, February 12, 2011

HTLPSensorNode

Today, I extended the humidity, temperature and light sensor node with a pressure sensor. Hence the name HTLPSensorNode. For measuring the environmental air pressure I used the BMP085 pressure sensor breakout board from sparkfun. On the product page you already have example code snippets and setup tutorials. I integrated the Arduino example code into my existing code and did some minor refactorings along the way. I also had to extend the pseudo JSON handling for the new sensor type. Adding the new sensor type to the project was a matter of only about 10 minutes.

Here you can see the extended setup of the sensor node:









I also updated the Android code to display the new sensor data type:


You can find the source code for the Arduino program and the Android application at github.

Monday, February 7, 2011

Arduino HTLSensorNode with Android data visualization

It has been some time since my last post, but I wasn't lazy at all. I combined some of the tutorials you might have seen before on this blog, to build a HumidityTemperatureLight Sensor Node. In short HTLSensorNode.
It is basically an Arduino Uno board with an extension shield for HTTP communication and sensors for environmental measurements.

I used a WiFly Shield on top of an Arduino Uno, but you could also use an Ethernet Shield with some minor code modifications.
The additional parts I used are the SHT15 breakout board from sparkfun, a simple photoresistor which you can find in any electronics store, a 10k resistor, a plastic enclosure designed for the Arduino and some connector cables.

Stack either of the shields on top of the Arduino and connect the sensors to the shield in the following way:






My setup looks a little raw and I will clean up the cable mess in the future but here it goes:

WiFly Shield with Sensors

Humidity and Temperature Sensor (left), Photoresistor (bottom right)


Project neatly embedded in enclosure
To address each sensor individually or all sensors at once, I implemented primitive pseudo JSON responses in the Arduino code to provide a really primitive REST interface. There is a JSON library for Arduino called aJson which you might want to check out if you want to do more JSON like projects. For my purpose however it was overhead to use it as I only needed some predefined responses.

To visualize the sensor readings I built a simple Android app which shows the sensor readings in a 5 second interval. By choosing a smaller interval you risk that the Arduino can't catch up with the responses. However sometimes the request got stuck anyway on the Arduino side, so I configured a timeout in the Android code.

Here is a quick demo of the project. Sorry for the bad video quality. My cheap camera had no autofocus.

video


Update:
I deleted this version of the Arduino code and the Android code from github. Have a look at the extended HTLPSensorNode project instead. The new project code can be found at github. Feel free to download and improve it. Have fun!

Wednesday, February 2, 2011

Creative Commons License

My new job started this week, so I won't have the time to post on a regular basis. However I will try to post new projects at least once a week if time allows.

I also decided to put a Creative Commons License 3.0 on my blog so that everyone is free to use the examples or resources. Please read the license details if you plan to use my work in your projects.

Thanks for all the positive feedback I got so far. It shows that there is a vibrant open source community out there.