Monday, June 4, 2012

G8P Relay Controller

Well I've been developing a dual relay controller board for use with my Smart Home system (its meant to be controlled via the Beagle Bone or Raspberry Pi). Its somewhat based on the NCD USB Relay board, but I've changed a few things and made it smaller. Trust me, my board looks nothing like theirs.

I wont go into too many details until I've gotten the board fabricated, assembled and tested. For now, I'd like to highlight some specs and code. The benefit of this board is that I've decided to embed a Teensy microcontroller into it, which means that this is a USB-to-Serial Relay board. So the Teensy is powered via USB. The relays however, will be powered via a 12VDC adapter. The relay power supply is separate from the Teensy power supply.

There are two Quick-Connect Contact G8P Relays on board. If I decide SPST, its rated at 30A at 250VAC, and if SPDT, its rated at 20A at 250VAC.

For reference, here is the ASCII byte command chart:

//The first is the command mode byte (not implemented); The second is the command byte. 

          (254),0-1 Turn ON Individual Relays
          (254),2-3 Turn OFF Individual Relays
          (254),4-5 Get the Status of an Individual Relay
          (254),6 turn all on.
          (254),7 turn all off.




Tuesday, May 22, 2012

Cosm, Prowl and The Internet of Things

I've been really distracted lately with various projects, and trying to explore my cooking creativity now that I'm getting bored of looking for work all the time. However, this blog isn't about my life, its about my tech research, which I've done a little bit of in the past month. Granted, I haven't gotten the Dragino to post sensor data to Pachube yet, but I'll get there. Which brings me to my first topic.

Pachube is now Cosm!

You heard it. Apparently, nobody could pronounce PATCH-BAY, so now its COS-M.
Now its interface has changed a bit from what it used to be. It's no longer just a cloud to aggregate and share your sensor data, but rather an Internet of Things system to help you control hardware based on that data. This is quite similar to PushingBox and Sen.se, except that Cosm has a much larger community, and doesn't really have to start from the ground-up. In any event, it should be interesting to experiment with the new system.

That brings me to another topic: the Internet of Things. I've found a really nifty (and very useful) iPhone app called Prowl, which allows an external site to push notifications to your phone for practically anything. Using Prowler for Firefox, Prowl for Chrome and Growl for Safari, you can push text and links to your iPhone. PushingBox can take in a sensor feed from an Arduino, and set an action to push a notification to you via Prowl. It can also send you an email, post to twitter and more. There are so many possibilities to this, but the big one that comes to mind is a notification when someone enters your home when you are not home. Doorbells are cool, but if you've got a small home, it doesn't really matter. If you're in the backyard, how likely will you have your phone in your pocket? Right. So, security is the big use that comes to mind when using this notification system. Very convenient, isn't it.

There will more plenty of time to discuss other topics I'm working on, but I wanted to give the run down on Cosm and Prowl, just to let you know of the technologies out there to give life to your next project. 

Take Care.

Saturday, April 28, 2012

Xubuntu 12.04 LTS

Well I ran into a bit of a snag when trying to install TFTP so that I can transfer the compiled hex program from my laptop over to the Dragino. Apparently Ubuntu 9.10 is no longer supported by the Application Manager, so you have to change the sources.list over to old-releases.ubuntu.com. That would have worked if I could get a working internet connection. 

So I decided to throw out the old version of Ubuntu, and switch over to Xubuntu 12.04 LTS. I managed to get internet on that over an Ethernet cable, so I was able to get all the software updates and installs done. I also managed to get the Broadcom 4360 driver installed so that I can get WiFi going on the laptop. If you are running into the same problem on Ubuntu, use this fix and reboot.
~$ sudo apt-get install b43-fwcutter firmware-b43-installer
Long story short, my system is back up and running in working order. 

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.