Mar 13

Color of light Changes Alertness

NASA has planned an experiment to attempt to help astronauts get sleep on the international space station. According to research, blue light helps wake people up while red light helps people fall asleep. This apparently means that staring at my computer screen before going to bed apparently doesn't help me fall asleep. But it does mean that my alarm clock should be heavy on the blue light to wake me up in the morning, and it could also have RGB LED's that go heavy on the red light as I'm getting ready for bed. That could help mimic the sunrise and sunset and give me a sleep pattern that is either more stable (because it's easier for me to fall asleep and wake up) or that is more easily tuned because I can give my body the necessary light cues to tell it to fall asleep when my work lets me. Either way, I'll need to experiment. And for that, I need the clock.

Article on color changing lightbulbs assisting sleep

NASA ISS color test

Mar 13

Example of a Sunrise Alarm Clock

One of the projects that I'm interested in building is an alarm clock with a variety of alarms to wake a person up. I've though of using LEDs to simulate sunlight, a motor to vibrate my pillow, a speaker to play music, a squirt gun, a spring-loaded mechanism to pull off my sheets, etc. I haven't built one yet, but the project has always been in the back of my head. I cam across a series of alarm clocks that simulate sunrise, and I like the one in the link below, particularly for its great bill of materials. I would use an arduino instead of the Arm processor because I have a few ATMega328p's I haven't found projects for. He also uses all open source products to create the project, which I think is awesome. I haven't dabbled in board layout much, and an open source program would be a great place for me to start.

Sunrise Alarm Clock

Dangerous Prototypes has a sunrise alarm clock that uses a PIC32. I've used one for another class, but since I'm focusing on ease of teachability, for now I'm going to stick with the arduino (very beginner friendly). This one plays sounds back, which is nice, but I can do that with an arduino as well.

Mar 11

Arduino Barcode Scanner

I've had an interest in barcodes versus RFID tags for a while now. Barcodes are easy to place on objects and can be printed for the price of printer ink and paper. RFID tags need to be purchased individually, but the RFID reader is pretty cheap (there's one at adafruit for around $40. Link below). Because of my previous knowledge of RFID tags (via learning on the internet), I thought that they would be easier for me to implement than a barcode scanner, since I haven't used one before and wouldn't know where to start. However, I just came upon an article on embedds.com about interfacing a barcode reader with an arduino. This could replace using an RFID system to keep track of objects, or not, depending on the application. At any rate, it's something to look into. Ladyada has a tutorial on how barcode scanners work (link below), but it doesn't include how to interface it with an arduino. It is a good tutorial; adafruit has a great learning system.

Barcode Reader Project: http://www.circuitsathome.com/mcu/connecting-barcode-scanner-arduino-usb-host-shield

Adafruit RFID arduino shield: http://adafruit.com/products/789

Adafruit Barcode Scanner Tutorial: http://learn.adafruit.com/barcode-scanner/overview

Mar 09

USB to Serial Converter

One of the most expensive parts of an arduino is the USB to Serial converter. These typically cost around $15, and considering the fact that the electrical components required to make an arduino compatible (ATMega328p chip, 5V regulator, capacitors, resonator/crystal, resistors) total around $3.48 for 1 or $2.70 when purchased in bulk of 100, the USB to Serial converter is about five times the cost of the other components (not including the PCB, which can vary in price depending on the footprint. a 2"x3" PCB is around $5 per PCB for a quantity of twenty at the time of posting).

Electronics-lab.com's Blog posted about a schematic for a USB to Serial converter (links to blog post and schematic below). A cheaper USB to Serial converter would be invaluable for creating lower cost arduino compatibles. Either that, or I have to use the same USB to Serial converter that the fellows who make the arduino use. They use an ATMega16U2 that has been programmed to convert USB to Serial, which adds another layer of complexity to the board than simply an FTDI chip whose sole purpose is to convert USB to Serial (more info at http://arduino.cc/en/Main/arduinoBoardUno).

The purpose of this search for a cheap arduino is to get it into the hands of as many children as possible to promote electronics education. While a $25 microcontroller (when bought in bulk) isn't prohibitively expensive, if a cheaper alternative is possible and a little research helps towards that end, why not try?

Electronics-lab.com USB to Serial Converter Blog Post: http://www.electronics-lab.com/blog/?p=21327

USB to Serial Schematic: http://www.obddiag.net/usb-2-serial.html

Mar 09

GeoCache Puzzle Box

Picture of the front of the box as it searches for a GPS signal

The front of my GeoCache puzzle box as it searches for a GPS signal

Last summer I built a GeoCache puzzle box as a gift. What is this puzzle box? It is based on Mikal Hart's Reverse GeoCache puzzle box (TM Mikal Hart, original article link is below). I read the article, and being a DIY college student, I decided to build my own puzzle box based on his design, only cheaper.

Mikal Hart's original article is here: http://arduiniana.org/projects/the-reverse-geo-cache-puzzle/

I started by doing some research on the parts required. Mikal Hart has a list of components in his article, and now there is even a website where you can go buy either the components or the a completed box (http://www.sundial.com/shop/) or just the electrical components necessary to control the box (except for the arduino and the GPS module, for some reason. Don't know why he didn't include those components). After pricing the components myself, I figured that I could build my own box (and learn about how everything works) for less. So I did.

I began with the GPS unit. Fortunately, Ladyada of Adafruit Industries has wonderful tutorials for GPS units, liquid crystal displays (lcds) and all sorts of other cool stuff. The tutorials that I used are listed below. Basically, I needed to learn how to get my position from a GPS unit, which outputs in a standard format called a NEMA sentence, and use that information to calculate where I am on the planet compared to where I want the box to open (I used the haversine formula to calculate how far the box is from the destination [where I want it to open]. Look it up on wikipedia if you like. It allows you to calculate the distance between two points on a sphere, and the Earth can be approximated as a sphere). Ladyada's tutorial teaches you all that you need to know and provides a library to parse the GPS data stream for you (basically, you don't have to understand how the GPS unit is outputting information. She wrote a library [code that you can use in your code] that checks for, collects and separates the GPS's output so that you can easily use the data it sends in your project. Nifty.) The tutorial also works for the GPS unit that I purchased from Adafruit industries. I chose that one because of the breakout board, which makes it easier to work with when trying to attach it to other circuits, the wonderful tutorial and the library to do the work of taking the data from the GPS for me.

Ladyada's GPS tutorial: http://learn.adafruit.com/adafruit-ultimate-gps

Next, I needed to pick an LCD. Adafruit again has a great selection of parts and a tutorial on how to use them. I chose a blue character (the letters are blue) OLED (organic light emitting diode) that has 16 characters per line and two lines to write on (16x2). It is not compatible with their backpacks, but I liked how it displayed much better than other LCD's. If one was looking for an easier LCD to use, I would go with one of the other LCD's that use I2C to communicate (I2C is a communication protocol that uses 2 wires. Hooking up the blue character OLED to my arduino used 6 wires. You can do it, but it's more wiring). The Adafruit tutorial is listed below.

Ladyada's LCD tutorial: http://learn.adafruit.com/character-lcds/overview

Now that I had a method to get my location and print out information to the user, I had to pick various other components for the actual project. I needed a button to allow the user to turn on the box, so I picked one that looked cool at the Adafruit store (www.adafruit.com). I also needed a servo motor (motor whose position you can control) so that I could precisely move a latch to lock the box. Then I needed to decide how to power it (batteries), what processor to use (an Atmega328p, the brain of an arduino), and if I wanted to put an arduino in the box. I decided against putting an arduino into the box, since I wanted to learn how to build an arduino clone, and I wanted to minimize the cost of the project. Links on how to build arduino clones are provided below. I also found a cheap cigar box on amazon.com and decided to use that as the box. I didn't need anything fancy. Just a box.

Arduino on a Breadboard: http://www.arduino.cc/en/Main/Standalone

Poor Man's Arduino: http://aeturnalus.com/robotics/poor-mans-breadboard-arduino/

So, now I had all the physical pieces that I needed, and now had to write the code to control the darn thing. I based my code on the GPS tutorial that Ladyada posted in her GPS tutorial at Adafruit. I won't go into the details here, but I basically wrote two programs: one to actually control the GeoCache puzzle box and another to test that code and see if it is working correctly. It's always important to test your code, as I didn't want it to fail after giving the box to someone as a present. I also added a backdoor mechanism to open the box in case of power failure or GPS failure. The box can be powered externally using two inputs near the hinge on the back, and after the box tries to shut itself down, if it is powered externally, it will automatically open itself (this kept me from driving to the place where it opened every time I wanted to test it).

After all the coding, testing, and assembling, I had a GeoCache puzzle box. It took around a month and a half to learn, build and test, but all in all I probably didn't spend more than 30 hours on the project. Not that I kept track. That's a rough estimate.

I hope this post is a useful guide to the methodology I used to gather the information required to build my GeoCache puzzle box and has some good resources. I may end up building another one, since I gave this one away as a gift and do not have it anymore. If I do construct another, I'll be sure to post the wiring diagrams and detailed photos of the build so that others can make this if they'd like. I've put a summary of the links below in case you want to click on all of them now.

Mikal Hart's original article is here: http://arduiniana.org/projects/the-reverse-geo-cache-puzzle/

Ladyada's GPS tutorial: http://learn.adafruit.com/adafruit-ultimate-gps

Ladyada's LCD tutorial: http://learn.adafruit.com/character-lcds/overview

Arduino on a Breadboard: http://www.arduino.cc/en/Main/Standalone

Poor Man's Arduino: http://aeturnalus.com/robotics/poor-mans-breadboard-arduino/

These are other pictures of the GeoCache Puzzle box, showing the internal wiring (messy. I'll try to make this less so if I build another) and the place on the back of the box to power it externally.

Internal wiring of the GeoCache Puzzle Box

Internal wiring of the GeoCache Puzzle Box

This is where one would power the box to open it no matter the location

This is where one would power the box to open it no matter the location