Wednesday, April 25, 2012

Dragrove Daughter Board

I found out why the Dragino doesnt want to boot once the Dragrove daughter board is plugged in. According to the Dragino schematic (Page 2, top left corner), Pin 4 on the Router connector (Dragino CON5), is the COLD reset pin via the daughter board. Using the Dragrove daughter board schematic as a reference, you can see that Pin 4 of the Router Connector links to Pin 7 of the Sensor connector (Dragino CON4) and to Pin PD4 of the ATMEGA micro-controller on the daughter board. 


My guess is that one of two things could be happening. Either the default code programmed on it is broken, or it wasnt programmed at all. In any case, Pin PD4 is set to HIGH when the board is powered. That causes the Dragino to COLD reset nonstop, which doesnt allow it to boot. The solution is to link a wire between Pin 4 and Ground. Use the following image as a reference for your jumper: 


This solution forces Pin 4 to LOW, which then allows the board to boot.

Once the Dragino boots, then you can SSH into it (and continue the tutorial), as instructed in the Wiki

Ive been working with Ubuntu, so for SSH its simple. 

Type in the terminal:
~$ ssh root@192.168.255.1
Then login with the password you set (or the default if you didnt set it). That allows you to get the Daughter board upgrade script from the SVN server. 
Then using a tftp-server you can upload your Arduino hex files to the daughter board. Make sure when you compile your code to include a line in there to set Pin PD4 of the ATMEGA to LOW. Remember to set the board type in the Arduino IDE as <Arduino Diecimila or Duemilanove w/ATmega168>.
#define COLD_RST (4)

void setup(){

pinMode(COLD_RST, OUTPUT);
digitalWrite(COLD_RST,LOW);
}

void loop(){
//return 0;
}
Flash the Daughter board using this guide, or as an alternative, you can unplug the daughter board from the Dragino and upload the bootloader with an AVRISP MKII. Afterwards, you can remove the grounding jumper. Just remember to add this piece of code to each sketch.

Operation Dragrove: Part 1

Getting a Dragino operational is actually quite simple. Just dont panic if things dont go as planned.

First you need to make sure the Dragino boots, as discussed here. All you need is a basic Ethernet cable (I used a CAT5 patch cable I had laying around). Once it boots, this is what the LED's should look like:


It might be difficult to understand what those LED's represent, so I'll make it easy on you, so you dont have to search around. Obviously the circle with the line is the Power LED. The Heart is the AVR LED. The Earth is the boot-up. The 3 squares connected together is the LAN connection, and the last one is the WiFi connection.

If you purchased a Dragrove, you'll have to remove the daughter board from the Dragino, in order to get linux to boot up. Not sure why this board is preventing the Dragino from booting correctly, but I'll find out. This is what the board looks like:




Now you should be able to ping the Dragino, as well as access it via Putty and WinSCP.

To set up the Dragino as an AP Client (i.e. it connects to the internet via another WiFi router), just follow these instructions (use 192.168.255.1 in your browser). I'll post in part two how to send data out to Pachube.

Monday, April 23, 2012

Dragrove Arrives!

Well my Dragrove arrived in the mail today, and I'm excited to get it working. I had ordered an XBee unit along with it, so I'll be able to set that up as well. Here's a picture of what it looks like.
Dragrove Unit


I thought this would be a plug and play device, but it isn't. There's a bit of setup to do. 

The downer at the moment is this: when powering it on and plugging the Ethernet cable in, nothing happens. The Power LED and the Heart LED (I have no idea what that one is for) light up, but there is no local Ethernet connection. I tried two different cables, and tried to troubleshoot the Ethernet connection, but still, nada. I don't have a clue why I cant connect. There are no LED's on the Ethernet port on the Dragrove for me to know if the connection works or not, but according to the LED's on my switch, the power led doesn't come on. That's a bad sign, but I'm still optimistic. 

I'll have to debug some more in the morning.

Sunday, April 8, 2012

Wireless Sensor Networks

I've gotten a little bored working with Ubuntu and OpenCV, so I've decided to switch gears back to the wireless sensor network development.

I've discovered a few things during my research that would make a wireless sensor network possible, without my having to develop my own hardware. Perhaps once I have a working prototype, I'll design and build my own hardware, but that's for the future.

For now, I'll share the gadgets that may make the wireless sensor network feasible. In a wireless sensor network, you have Zones. In each zone, you'll have nodes that each do a certain task. You might have some controlling the AC system, a few monitoring the air quality and maybe one controlling your hot water heater. Nodes can do all sorts of things. Zones can either be assigned to do one task, or handle multiple tasks for a single area. Its all about perspective. I haven't quite figured this whole concept out, so bare with me.

In my Wireless Sensor Network, I would like Zone Control units to have many wireless features as possible so that you could work with WiFi, XBee and perhaps Bluetooth at the same time. It would be convenient to have a fast/strong processor to handle crunching some data before sending it off to where ever its going. For regular data, one can just use these units as a wireless gateway, but for images and video, it might be a good idea to compress the data to make sending it faster and easier. This is where there Dragrove comes in. It contains all the features of a wireless gateway, including an ARM processor and embedded Linux. The Dragrove also is Arduino compatible, has a place for an XBee module, as well as an RF module. You can even use the unit for local digital I/O data if you want to have just a wireless gateway without nodes. It has screw terminals on the side for loose wire, and connectors inside for special Dragrove shields.

Lower level units - Nodes - could simply be Arduino's with the control hardware (or sensor packs), with an XBee for communications. Very simple, doesn't need to be complex or any fancy data processing either. Even Data Display units can be nodes. Being a node doesn't necessarily mean that data is going one direction, its possible to receive as well.

To make this system complete, one must have a way to store all this data from the sensor network. Enter Pachube (pronounced PATCH-BAY). Pachube makes this all possible. Especially now that their service is FREE. You can have unlimited private feeds at no cost. So your local system can send data over to Pachube, the data can be crunched and handled, and you download your feeds back to your system for analysis. Its very convenient if you ask me. This allows mobility of your data. You can access your data feeds anywhere in the world, and keep an eye on your system. This also takes a lot of work off my hands, as the system is practically ready to go. You just need to setup your Feeds on Pachube, and setup your data transmission (i.e. uploading sensor data to Pachube), and off you go.

Now I've included links to few websites I've discovered that might help folks:


Paraimpu is a social tool that may help broadcasting certain data easier.

OpenPicus has Flyport modules which are stand-alone system on module with a customizable webserveremail clientTCP/UDP/FTP and more. OpenPicus also has Ethernet and WiFi modems for wireless sensor and hardware control networks; there are wide applications for this.

Flukso is a community based metering application.

Open Energy Monitor has all sorts of things you need to get started on a home energy monitoring tool.

For those of you who have a Two-Story home and have to wait while hot water comes to you, I have a solution for you. You no longer have to waste water flushing out the line until hot water arrives. A Hot Water Recirculating Pump is your solution. While they are a little pricey at first, in the long run they will save you money. Today water is becoming more and more valuable, so you really should conserve it as much as possible. This method allows you to get hot water faster, without wasting water (and if you plan right, you wont really waste much electricity either).

Well, that's all I've got for now.

Peace Out.

Wednesday, March 21, 2012

OpenCV Processing

I discovered something thats quite annoying when working with OpenCV and Processing, so I'll share here. Hopefully you can get it running without searching around.

To get OpenCV working with Processing, just follow the steps on then OpenCV website.

Then use the example given on Sparkfun, to get Face Tracking working. But, if you're like me, you'll probably run into the same problem. You try to compile, and Processing throws an error: 


Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: hypermedia.video.OpenCV.capture(III)V 

This has to do with the following line of code:

opencv.capture( width, height );

Solve this error by copying the following files into your System32 folder.

cv100.dll
cvaux100.dll
cvcam100.dll
cxcore.dll
cxts001.dll


If copying them into the System32 folder doesnt work, copy the files into the WINDOWS folder. Thats it!

Note: Heres the forum thread where I discovered this solution.


Your example should work without you having to reload Processing. If you dont get any video feed, then the problem is with your Camera setup, not with Processing or OpenCV. In the past, I had a Logitech camera work on the fly (thats using Windows 7, x64bit), but now Im working with a Microsoft camera that I havent figured out how to get working. I'll post when I do.

Monday, March 12, 2012

Smart Camera

I think its about time for an update.

So this last month I was working on building a smart camera that tracks motion using Open CV, and determines range/speed for threat detection. I got the enclosure design down with Pro-E, so it was just a matter of getting electronics, and putting something together.

I had decided that a laser rangefinder was the best method to get the distance/speed measurements that I needed (range of 50-100ft). My budget for this camera was only a few hundred dollars, so was I in for a surprise. The laser rangefinding component is about $500 on its own. So I thought, maybe I can just build this thing myself, and cut out the middle-man who builds it.

I'll save you the trouble of researching it. Theres several things you'll need. First off is an Avalanche Photodiode. Those go for about 50 bucks, but since they require a few hundred volts to operate, you'll need a power circuit to supply that, and an amplifier circuit to read the data coming off. Thats not exactly easy, or cheap. Second is the laser: you'll need a solid-state hybrid pulse laser that gives you a 14W pulse every 200ns (I think). Those run for about 50 bucks also, but are a bit hard to acquire, because they are sold in Germany, and have a min order of a couple thousand. Then you'll need power, amplifier and sync circuits to power, run and synchronize the laser to the photodiode. You'll probably have to do all this on an ARM or an FPGA since calculations happen pretty fast for this thing to be accurate. So thats another 80 bucks for a BeagleBone. The custom laser/detector optics will run you for about a 100-200 bucks easy. So it all adds up to a cool $500. You can save yourself the trouble of custom making it, and order a prototype laser rangefinder from Lightware. So that wraps up the laser range finder.

Next up is the Pan/Tilt OpenCV camera. Its rather easy to make one. In fact theres a tutorial on Sparkfun to do it, but I ramped up the design a little bit. Instead of cheap analog servo's, I decided to use digital servos with metal gears (from Servocity). For the pan/tilt hardware, I decided on Servocity's SPT200. For a camera, I planned to use a cheap $40 Microsoft HD webcam. So all in all, maybe about $150 for the pan/tilt camera.

Lastly, I had to get some kind of water tight enclosure built for this thing. Since I had a design drawn in Pro-E, its simply a matter of getting it all 3D printed somewhere, and throwing hardware in it. That'll probably run me for another 200 bucks or so.

So, a cheap, couple hundred dollar project turned into a thousand dollar behemoth. Ive decided not to take up this challenge at the moment while looking for a job. Its just not practical.

What I have decided to do in the meantime, is get my Gas Monitoring system working. In fact I managed to get the MQ-6 LPG-LNG Gas Alarm working yesterday. The code I used was originally meant for Sandbox Electronics' LPG Gas Sensor Module, however, I changed a bit of it and added my alarm code. Now it triggers an alarm every time the gas level goes higher than a user threshold (thats currently set in the code, but later I'll use an interface to have a user type it in). I know thats rather easy, but setting up the calibration of the sensor isnt easy, so I had to dig around until I found someone who had done it, to make my life easier.

Im working on the MQ-7 CO Gas Alarm right now, and thats just a variation of the previous alarm. Only difference is the code has to adjust the power of the sensor heater via PWM to match the specs in the datasheet. 



Well thats all for now. Peace Out.

Saturday, February 11, 2012

Servos & Stuff

Well work has slowed down quite a bit since I was laid off, and lately Ive been spending most of my time just looking for work. Thankfully now I have all the time in the world to work on my project.

Heres a little update:

I dug up a few old Airtronics servos that Ive had for awhile, so I fired them up to make sure they work. I used some code freely available online (I'll upload it when I remember the website). Basically I can move the servo back and forth with the '<' and '>' keys. So I managed to test both servo's that I'll be using with the Pan/Tilt camera. I still have to buy myself a nice HD camera that I can use with all the OpenCV stuff that I'll be doing. So far all the OpenCV examples Ive run have been on images and video files, not with live video from a camera. Once I acquire that camera I can make a fully automated pan/tilt camera as seen on Sparkfun.

Step two is building a custom laser rangefinder.

Thats all Ive got for now. Peace out.