March 18, 2011

Arduino relays

I'm putting my newly learned Arduino knowledge to practical use. Since I don't really know any electronics, I went to a local electronics supplier called ETT to see what pre-made boards they have. While looking around, I discovered that they make a custom Arduino board with a mouthful name called ET-EASY MEGA1280 Duino Mega that easily connects to their boards using a simple 10-pin connector.


This is the Duino Mega connected to a 5V relay board. The 5V board can be powered directly from the Duino Mega board which is powered from USB. Also connected is a Sharp GP2Y0D21YK infrared sensor. The sensor is a digital sensor with a 24 cm range.


Here's another relay board also produced by ETT. This is a 12V relay board that needs to be externally powered. Actually I got the 12V board first, but then I saw the 5V board that can be powered from the Arduino. But after getting the 5V board I was afraid that it might draw too much power. But both seem to work perfectly fine.

I wrote a little sketch that controls the relays using commands transferred over USB serial as well as reads the status of the infrared sensor. My first Arduino project is a motorized computer scale system. One relay is used to control the motors of the conveyor belt and the second relay is used to toggle a warning siren. The infrared sensor (which will be replaced by a laser sensor in production) is used to sense when to stop the conveyor belt in order to weigh the product.

Of course, the system has a load cell and a weight indicator that also has to be connected to work. The load cell is connected to the indicator through a special load cell connector, and the indicator is connected to the computer using a simple USB serial port converter.

March 14, 2011

March 10, 2011

Linksys WRT160NL and DD-WRT

A few years ago, I wrote about the Linksys WRT310N and DD-WRT. I no longer have that router since a friend decided to borrow it permanently, and I ended up selling it to him.

When my ASUS WL500gP died last year, I tried to buy another unit only to find it wasn't available locally any more. So I went looking for an alternative, and the Linksys WRT160NL was what I found. I've had one for a few months already, and recently I bought a few more as it's quickly turning into my favorite router.

WRT160NL has a 400 MHz CPU, 32 MB RAM, and 8 MB Flash. The It has a USB port ("Storage Link") for attaching USB storage devices. However, with DD-WRT, it can also be using for USB printing. The box has a penguin logo and it's just inviting me to put a third-party firmware on it.


I'm running the most recent DD-WRT (16214 as of this writing) on it. With this version, I can enable USB Printer Support from the web interface and it automatically works with my inkjet printer. With earlier versions I had to manually install p910nd to get printing to work. DD-WRT doesn't have a detailed changelog so I don't know when this happened, but I'm glad it works "out-of-the-box" now.

The DD-WRT router database currently shows version 14896 for download. This version seems to have wireless problems since I seem to lose wireless connectivity after a while. 16214 also seems to have fixed that problem.

While trying to figure out the wireless issues, I also followed the recommendations in this thread and set my TX Antenna to 1+2+3 and RX Antenna to 1+3 and Antenna Gain to 2, which seems to greatly increase my wireless stability and connectivity.

Oh, while I was playing with upgrading the different firmwares, the WRT160NL locked up completely. It would no longer finish booting and the power light just flashes. However, upon closer inspection, I discovered that the router wasn't actually "bricked", and I managed to recover it simply by using tftp to upload the linksys-to-ddwrt-firmware.bin to it. After it rebooted, then upload the actual wrt160nl-firmware.bin to it using the web interface.

Just to be sure that it wasn't pure luck that I recovered the router, I purposely crashed the router several more times, and each time I managed to recover it by using tftp.

The WRT160NL also works with Gargoyle, which I'll talk about next time.

March 3, 2011

Giant iPod touch


iPad 2 was released earlier today and it looks almost exactly like the leaked photos. I was one of the few people that thought the leaked iPad 2 photos were real, since it follows closely Apple's recent design paradigm: no more round backs. The iPad 2 looks almost exactly like the fourth generation iPod touch, which I really like.

But what I like most about the iPad 2 is that it's much lighter! I've had the iPad 3G for a few months and I no longer really notice the weight, but whenever I pick up iPads without 3G I notice how much lighter they are. The iPad 2 with or without 3G are both lighter than the original iPad. But I probably won't upgrade unless I can get one for free. Besides, my iPad is jailbroken.