Tuesday, December 25, 2012

Dragonboard Update!

Dragonboard V1.0.5 is 99% ready to be sent off to the Fab shop. I just have to resolve an issue with OSH Park, and I'll get it ordered. I have selected and compiled a parts list and am ready to make the big order from Mouser and Digikey. I checked and verified a few things with viewing Gerbers to see that the board looks good, and I learned a few things worth mentioning here.

For those who use GerbV, listen up. Dont panic if you open GerbV and dont see your imported bitmaps. GerbV has a bug which doesn't allow it to show features imported with Eagle2BMP.exe, since the default DPI is 10k, and the viewer can only handle about 300DPI. The way to get around this is to use import-bmp.ulp, and manually enter in a DPI value. Its a bit time consuming, but it works. 

And FYI, if you have your Eagle library in the Eagle lbr folder (which is where Eagle is installed or me), you wont be able to generate the bmp.scr for your imported image. So be sure to import your images into a library that isnt in your Program Files, and then import the individual parts across from that library to the library you use regularly. Problem solved. 

However, I found a great work around to even needing a Gerber viewer. I can render 3D CAD files directly from my Eagle Board Layout, and save whatever view I want into PNG format. This is how it works: A clever combination of Google Sketchup, ImageMagick and EagleUp. Follow the tutorial at the link, and you'll be up and running viewing your 3D Boards in no time. This way you can view your Board Layout, and not only verify the parts layouts, but also the board view in 3D space. How exciting! If you're planning to use OSH Park to Fab your boards, I went with these two colors for the EagleUp.ulp script: Board color is 0x462f5b and Trace color is 0x663a93. Thats it! 

If you want a quick way to view your Gerbers, you can always use the online viewer at Circuitpeople.com.

For those interested in exporting a Bill of Materials List, without the hassle of doing it manually, theres an easy way through a script in Eagle, called BOM.ulp. This script gives you the option to group by name or by value. I usually group by value to make the BOM easier to read.
 
Heres a teaser of the Dragonboard:




I hope everyone has a Happy Holidays and a Happy New Year!

Thursday, December 20, 2012

Finding Components in Eagle Schematic Design

I came across a good tip for Eagle and thought it would be nice to share with everybody. If you've just designed a rather complex circuit, with many parts (and possible many pages), sometimes Eagle will name things with odd naming schemes, and you're left wondering wheres the odd number left out of the number order. Ive run into this several times, and its quite annoying. So I discovered a unique solution, that the folks at Eagle already thought about.

Find.ulp will locate a part in your schematic based on an inputted reference designator or part number. Not only will it give you exact X and Y coordinates on your schematic, but it will zoom in on that part and highlight it. 

If you want to add a shortcut, as 'Control + F' to find components in your schematic, you can type in the Eagle Command Line:

ASSIGN C+F 'RUN find.ulp'; 
Additionally, you can modify the Eagle.scr file to add a button on the Eagle toolbar. This is well documented in the EAGLE HELP: Editor Commands > MENU.

Sunday, December 16, 2012

Dragonboard V1.0.0

I havent had an update in awhile, so I figured I'd give a status update. The last few months have been hectic, but Ive managed to cram a lot of time towards my project, and am almost ready to finally get my first legit prototype board off to the fab shop. Ive christened it as the Dragonboard. 

Its a multiple-use microcontroller board meant for operating RFID modules and gas sensor modules (of which are in the design phase right now). Its a pretty nifty little device that only has a dimension of 3.25 x 2", with an on-board RTC, a 9-16V DC/AC power supply, a 3-Axis accelerometer, an EMI suppression circuit for USB programming, an XBee, and all supporting hardware for the circuits. It also allows for on-board programming of the XBee.

Once I get it back from the shop, I'll post some updates about programming it, operation and whether or not it passes my tests for operation. Im crossing my fingers that this thing works out like Ive planned. Anyways, thats about all I wanted to say about it for now.

Sunday, November 11, 2012

Resistor Color Codes

Most people dealing with electronics these days know how to read a Resistor Color Code Value Chart, but beginners probably dont. This tutorial should walk you through how to read a chart to determine resistors in your projects. So lets get started.

A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element [1]. They come in many compositions, but there are three primary ones that people use: carbon film, metal film and wire-wound resistors. For more information about all other kids of resistors, as well as a detailed explanation of the three types mentioned here, refer to the Wikipedia page on resistors.

Classification of resistors consists of three main properties. Resistance, which is measured in ohms, is the actual value of the resistor. Without this, you cant tell one resistor from another. The second is the tolerance value, which is shown as a percentage, and is represented by a color band of its own. The last property is the power rating of the resistor, which is measured in Watts [2].

The value of the resistor, as well as the tolerance percentage can both be found by using the following chart.


Image Source: 300Guitars.com
For four banded resistors, the first band is the first number in the value of the resistor. The second is the second number in the value. The third is the number of zeroes behind the first two numbers, also referred as the multiplier. For example, Red-Red-Black, would be 220 Ohms. Similarly, 1K Ohms would be Brown-Black-Red.

For five banded resistors, the third band represents a third value, the fourth band is the multiplier, and the fifth band is the tolerance. These types of resistors are usually blue, green or brown, depending on the manufacturer.

The tolerance value represents what error the value known might be off from the actual value of the resistor. Most electronics use the standard 5% or 10% resistors, which is represented by a gold or silver band. Sensors and precision electronics require higher tolerances. Those come as actual color bands. Most precision resistors come with a 1% tolerance (Brown), though, other tighter tolerances can be found. So a 237 Ohm resistor with a 0.5% tolerance would take the 5-banded color code, Red-Orange-Violet-Black-Green.

The wattage rating of a resistor is determined separately by the size of the resistor. The larger the diameter and length of a resistor, the higher wattage it can handle.

Monday, November 5, 2012

ESD-Protective Bags & Packing Foam

So today I wanted to give folks a rundown of ESD-protective materials that are available for those who need to package, store or ship electronics, but just dont know what to get. As a hobbyist electronics person, I know how challenging and sometimes frustrating this can be. You can usually get away with using the little bits of ESD foam that come with your electronics, or even the ESD-protective bags they come in. Sometimes, this isnt enough, or the bags might be damaged, thereby defeating the purpose of using them.

When you are working on a project, small or big, you need to organize your project in bins so that you can constantly keep track of where everything is, and avoid an accidental static discharge that will destroy your precious electronics. I know people usually get lazy about this, and they tend to strew everything across their desk or the floor, as do I as well, but to progress from amateur to professional electronics project development, you have to improve your storage methods to better manage and care for your electronics. So explanation aside, lets get to the good stuff.

First, everyone knows about ESD-protective bags, they come in all sorts of colors and shapes. Some have zip locks and others dont. You've seen the silver ones, the pink ones and the blue ones. Maybe you've even seen the black ones. I'll explain what each is, and the application for it.

The pink/blue/green ESD-protective bags are Anti-Static bags made of low-charging material, meaning they will not create harmful static electricity charges when the bag surfaces rub together, but will not protect the item from electric fields. Depending on your application, you may or may not be able to store sensitive electronics in these. They come in both zip and non-zip styles. These tend to be the cheapest.

 A few things to note about Anti-static bags [1]:
  • Antistatic bags offer NO effective protection against a contact ESD!
  • They should only be used for NON STATIC SENSITIVE components, e.g. nuts, bolts, paper etc.
  • ORDINARY PLASTIC BAGS can generate and hold static charges in excess of 10,000v!
  • Antistatic bags deteriorate with time and wear, MONITORING them is VERY IMPORTANT.

The silver ESD-protective bags are Metalized Shielding bags made with anti-static plastic and a metalized film, which forms a Faraday cage around the item to be protected preventing any localized charges from being deposited onto the protected devices as the bags are handled. This allows them to shield sensitive electronics from outside radiation or radio waves.   A lot of electronics, especially IC chips will come packaged in this type of bag. They come in both zip and non-zip styles. These tend to be more costly than regular anti-static bags, but are used most often. 

A few things to note about Metalized shielding bags [1]:
  • DO NOT CREASE the bag, as this can breakdown the integrity of the metalized shield!
  • Metalized Shielding bags CAN DETERIORATE with use, MONITORING them for effectiveness is VERY IMPORTANT!

The black ESD-protective bags are Conductive polyethylene bags which are both anti-static and shielding. Unfortunately, since they are also conductive, if you build up a static charge by walking across a carpeted floor with shoes, and you hold this bag, everything inside will get damaged. So this bag is for use primarily when it will be grounded at all times, such as in storage. These are most expensive, but have drawbacks for general use, so arent used as often.

 A few things to note about Metalized shielding bags [1]:
  • It is POSSIBLE TO DAMAGE a static sensitive component inside a Black Conductive bag with a contact ESD!
  • Black Conductive bags, holding static sensitive components, should only be handled in an EPA and while the person is grounded in order to ensure that no potential difference occurs.
  • Black Conductive bags allow for a good path to Earth when used with other.

So now you know about ESD-protective bags. For more information on ESD-protective bags, visit Packingknowledge.com. Next, I will give a brief rundown on ESD-protective packing foam. Similar to ESD-protective bags, foam also comes in Anti-Static and conductive.

There are many types of ESD-protective packing foam, but the two most used are polyethylene and polyurethane. Polyethylene foam is "closed cell" foam, it has a smooth skin and it tends to be very hard. Besides hardness, it is less likely to retain moisture and more chemically inert than polyurethane [2]. This tends to be the black conductive foam [3].

Polyurethane is "open cell", and you can see the miniature bubbles in cross section.This is a soft foam, and it is good for cushioning [2]. This one tends to be the pink anti-static foam, however, you might find some polyethylene anti-static foam in packaging to secure devices from moving during transport [3].

So there you have it. A brief, quick rundown on ESD-protective bags and foam. For even more information about ESD-protective bags, visit The ESD Journal

I hope this helps your future ventures to storing and organizing your electronics projects.

Monday, October 29, 2012

Teensy 3.0 Arrives!

I just got my Teensy 3.0 today, and Im excited to work with it to get a feel for ARM M4 development. 

One of the most striking differences between this and the Teensy 2.0 is the board color and size. Its black and about a quarter of an inch longer than the former board. Also to note it obvious has the USB 2.0 Micro-B connector not the USB 2.0 Mini-B as the previous Teensy has.

Another immediate difference is the size of the chip. Its much larger and has twice as many pins. The board itself has many more pins packed in that tiny space than the Teensy 2.0.

Finally, the most promising, and most important feature, is the fact that this is an ARM Cortex-M4 with Arduino-style programming. You can see more on development using this powerful device on DangerousPrototypes, and the PJRC Forum.

The Kickstarter page is also available here if you want even more information.

Here are some of the specs of the Teensy 3.0:

Manufacturer: Freescale Semiconductor
Core: ARM Cortex M4
Processor Series: MK20DX128VLH5
Data Bus Width: 32 bit
Maximum Clock Frequency: 48 MHz 
(Up to 94 MHz Overclocked)
Program Memory Size: 128 KB
Data RAM Size: 16 KB
EEPROM Size: 2 KB
Digital Pins: 34  
PWM Pins: 10
Analog Pins: 14
DAC Pins: 0    
On-Chip ADC: Yes
On-Chip RTC: Yes
Operating Supply Voltage: 5V
USB Version: 2.0
USB Type: Micro-B

Photo Credit: John Beale

Friday, October 26, 2012

Beaglebone LCD3 Arrives!

Finally, after waiting for about 2 months, Ive gotten my LCD3 cape for my Beaglebone. Now I can start working with a screen. While it is the smaller of the two screens you can get, 7-inch for the larger, and 3.5-inch for the smaller, its still a useful screen to work with. 

After discovering today that Texas Instruments released an image of Android for the Beaglebone, Im strongly leaning towards writing that image to another SD card and trying my luck at getting Android working on the Beaglebone. The great part is the TI tutorial for their Matrix GUI takes place on the Android system, so I feel thats my best bet for getting the config I want actually working. Plus, Android has a MUCH more friendly GUI over Angstrom Linux. Even Angstrom with Gnome isnt all that great, from what I can tell visually.

As far as updates with the current Beaglebone build, Ive been unsuccessful as of late in getting my WiFi connecting - I think its a problem with my Xubuntu laptop. Ive setup the driver & the WiFi module lights up, but when I go to restart the WiFi config file, Angstrom & my XUbuntu terminal both hang. When I unplug the Beaglebone, the XUbuntu laptop crashes, and Im forced to reboot.

Either way, I will have to start from scratch with this WiFi issue on Android if I want to move in that direction. I'll post updates on this, as Im quite sure a lot of folks are interested about this topic. 

The build as it stands now:
~Beaglebone with Angstrom Linux and WiFi (no WiFi in the image below)

~An expansion cape with an XBee

    ~An LCD3 3.5" Touchscreen with Interface buttons

      Just have some Linux FYI:


      To shutdown, type:

      sudo halt
      or
      sudo shutdown -h now

      To reboot, use:
      sudo reboot
      or
      sudo shutdown -r now

      For more information on these commands, use:
      man reboot 
      
      man shutdown

      To see the current network connections, use:
      sudo ifconfig

      Wednesday, October 10, 2012

      Arduino Low Power Tutorial

      Ive been working with power save mode for the Arduino lately, and Ive found that while there are multitudes of examples out there, nobody specifically gives you a working example to run with. In this post, I'll walk you through my code, and at the end, I'll provide you with a great working example of using an interrupt button to bring the Arduino back out of a low power state for a few seconds and then back to sleep. This is great for applications that require the use of a battery for long periods of time and charging is scarce.

      You can follow the interrupted sleep tutorial by NoMi Design to learn just how to set things up.

      My code, however, is just like this example, provided on Engblaze.com, except that Ive added some serial communications to see that its working visually and to re-enable the interrupt attach so that I can constantly bring the device out of sleep every time it goes to sleep.

      //remove the space between '<' and 'avr'.
      #include < avr/interrupt.h>
      #include < avr/power.h>
      #include < avr/sleep.h>
      #include < avr/io.h>
      
      void setup()
      {
         Serial.begin(9600);
          DDRD &= B00000011;       // set Arduino pins 2 to 7 as inputs, leaves 0 & 1 (RX & TX) as is
          DDRB = B00000000;        // set pins 8 to 13 as inputs
          PORTD |= B11111100;      // enable pullups on pins 2 to 7
          PORTB |= B11111111;      // enable pullups on pins 8 to 13
          pinMode(13,OUTPUT);      // set pin 13 as an output so we can use LED to monitor
          digitalWrite(13,HIGH);   // turn pin 13 LED on
      }
      
      void loop()
      {
          // Stay awake for 1 second, then sleep.
          // LED turns off when sleeping, then back on upon wake.
          delay(2000);
          Serial.println("Entering Sleep Mode");
          sleepNow();
          Serial.println(" ");
          Serial.println("I am now Awake");
      }
                      //
      void sleepNow()
      {
          
          // Choose our preferred sleep mode:
          set_sleep_mode(SLEEP_MODE_PWR_SAVE);
          //
          interrupts();
          // Set pin 2 as interrupt and attach handler:
          attachInterrupt(0, pinInterrupt, HIGH);
          //delay(100);
          //
          // Set sleep enable (SE) bit:
          sleep_enable();
          //
          // Put the device to sleep:
          digitalWrite(13,LOW);   // turn LED off to indicate sleep
          sleep_mode();
          //
          // Upon waking up, sketch continues from this point.
          sleep_disable();
          digitalWrite(13,HIGH);   // turn LED on to indicate awake
      }
      
      void pinInterrupt()
      {
          detachInterrupt(0);
          attachInterrupt(0, pinInterrupt, HIGH);
      }
      

      Dont mind any avr's at the end. Its a glitch the website keeps doing when I post #includes at the top of the code on the blog.

      Sleep Modes

      Finally, its important to discuss the types of Sleep Modes that you can choose from. There are 6 sleep modes available on the Arduino Uno (ATMEGA328):
      • SLEEP_MODE_IDLE                   – least power savings
      • SLEEP_MODE_ADC
      • SLEEP_MODE_EXTENDED_STANDBY  
      • SLEEP_MODE_PWR_SAVE
      • SLEEP_MODE_STANDBY
      • SLEEP_MODE_PWR_DOWN    – most power savings
      SLEEP_MODE_IDLE provides the least power savings but also retains the most functionality.  SLEEP_MODE_PWR_DOWN uses the least power but turns almost everything off, so your options for wake interrupts and the like are limited.  Power reduction management methods are described in more detail on the avr-libc documentation page. For details on what features are available with each power saving mode for the Arduino Uno, please refer to the ATMEGA168/328p Datasheet (look out, its a 12mb file). For all other Arduino's refer to either the Arduino website, or the Atmel website.

      Ive decided to go with SLEEP_MODE_PWR_SAVE for this example, just because it gives me some flexibility with waking it, and because the power savings are a bit better than idle. Power down is overkill for my applications, and its comparative to actually turning off the device, which I don't need my hardware to do.

      You're welcome to ask questions, about this code if you arent sure whats going on. The bit of setting up the pins in the Arduino hardware is explained more on the Engblaze post.

      Saturday, October 6, 2012

      YAWS Assembly

      Most of the rest of my hardware arrived yesterday, so Ive begun to assemble things. During my Live Tests outdoors with the Weather Board, I came across a few things which I feel I should note.

      Ive revised the Sparkfun code to show the Wind Direction in Degrees (as in the code) and in Headings (N, S, E, W). This is a simple set of if-statements to display headings when the correct range is found.

      Ive also updated the code to remotely reboot the board on command, as Ive found that it has issues with starting a connection once its out in the field. The software has to be running first before the Weather board, thus a reboot is required. This is simply including setup(); in the reboot function.

      One of the things I wanted my Weather Station to do was display data via an LCD locally, so I can debug and view data in Real Time to make sure the station is functioning (and so I don't have to keep running back and forth to my computer). So I included a case in the code to display to the LCD screen and the serial port at the same time. I wont know for sure if this will work, but the code does compile. The way Im connecting the LCD screen to the Weather Board is via I2C using this tutorial. This requires a nifty little IC, the PCF8574P, an I2C 8-bit port extender and a 3.3V LCD screen. I'll post pics of it once its assembled and working.

      I guess now is as good a time as any to warn about the importance of a grounding kit on the weather station. You don't want lightning frying your expensive electronics, or burning down the shed (or your house), so you'll want to take good grounding measures. Do plenty of research to make sure you know what you are doing. I am not liable if you ignore this warning and lightning does hit your stuff (God forbid it of course).

      So that said, I used a 4-ft long piece of grounding rod (it comes in lengths of 8ft for about 10 bucks at Home Depot). Hammer it until about 1.5 ft of it is sticking out (the softer the ground, the shorter the rod should be; if the ground is hard, dry dirt, you might have to go to a 6ft rod or use the full 8 ft - this will change the amount of rod sticking out of the ground). You dont want to hammer it all the way in because the rocks in the ground will wear away the copper coating of the rod and that will accelerate decay of the steel rod. I also bought some #4 multi-stranded electrical cable, grounding clamps and a pencil-thin steel rod. All this stuff comes together as the grounding kit. A necessary expense to keep things safe.

      It looks like the weather station meters will just be attached to the steel pole of the mounting kit using stainless steel pipe clamps (the image below simply shows the mounting kit, now how Im going to mount it).


      Im still trying to work out all the minor things, like some extension cables for the sensors and the solar panel to reach where Im mounting the Weather Board.

      FYI, There will be a post soon about setting up the Beaglebone, as Ive gotten half of the stuff I need to start that side of my project. Configuring it is a pain, but it has to be done.

      Wednesday, September 26, 2012

      Yet Another Weather Station

      During my escapades as a Research Assistant, while I was working towards my Master's degree, I had the privilege of purchasing and setting up a weather station at UNT. The Campbell Scientific Weather Station did everything I wanted it to do, and it was well constructed, but it was also well out of my own personal budget. Thus my goal of this weather station was to keep the components within my budget while achieving good, solid construction and reliable software.

      In addition to this, I found that if am to build a custom smart home system, I need to construct a weather station from scratch so that it will be compatible with the rest of my system.

      One of my aims for this project is that it should be self powered and self sustaining as much as possible. The weather board listed here has a JST connector for power via a Li-Ion battery, and can also be powered via USB. I decided to go with a Li-Ion for the main power. To keep the battery charged, I will be going solar. The build is comprised of Sparkfun, Adafruit and Amazon components.

      Since this weather station can be easily reproduced and since it is comprised of open source hardware, I'll fill you in on the tid-bits.

      From Sparkfun Electronics:

      From Adafruit Industries:
      Since the weather station from Sparkfun doesnt come with a temperature/humidity external sensor, I may have to construct my own, using two sensors:
      While the weather board makes the I2C headers from the micro-controller accessible via the expansion header, the Sensiron I2C sensor is out of my current budget, and therefore I will construct my own device out of sensors I already have. 

      Finally there were a few things left to get from Amazon, since obviously thats the cheaper route to take for someone with a tight budget. I needed a mounting kit for the weather station so that I could place it somewhere high up, like on a roof, and an extension pigtail cable for the RPSMA connector:
      With these items bought, I just have to assemble everything together, upload my own customized code to the weather station board, and set it up for operation outside. I have decided to use a 16x2 LCD screen for local debugging to make sure the sensors are working, and I have a Processing program running to log data on the computer.


      Friday, August 31, 2012

      Smart Home Prototype

      Since last time that I posted, I went ahead and made a plan for the Smart Home System that I wanted to build. I found that I just didnt have the budget to make the full scale prototype, so I decided on making a 1/3 scale prototype to demonstrate functionality and features, and then try to get some grants or Kickstarter money to fund the rest of the prototype.

      So I ordered a ton of parts from Sparkfun, Pololu, SeeedStudio and Pro-Advantage, as well as bought a bunch of stuff from my local electronics store. Everything came in today (minus the stuff from Adafruit which is on Backorder). I've already gotten started on the RFID Door Lock Module, which is simple enough, but surprisingly, with all the tutorials and examples out there, I still struggled a little bit in writing the code. I'll post the tag checker function on here once I get it working. Simply put, the main structure of my code follows this: ID-12 RFID Tag Reader Sample Code.

      I plan to have an Arduino Fio (with its battery pack), the RFID reader and an electronic door strike to complete this module. The benefit here is that there is also an XBee attached to the Fio. So when the door opens, the Smart System is notified, and things start happening. I'll post code when I can: I plan to turn this into a sellable product, so I dont want to give away too much source code. 

      Thats all for now. Peace Out.

      Wednesday, July 25, 2012

      Rensas RL78/G13 Promotion Board

      Well, I got my Rensas promotion board today, so Im excited to see what features it can provide me, and if it can fit into my project. Great thing is, I made the sample request yesterday, and they sent it with 1-day shipping. You better get one while this lasts, even if you dont have a need for it, its free!

      The features according to the RENSAS Website
      • World’s leading low power performance for equivalent MCUs in its class 
      • Scalability of line-up, including smart pin layout 
      • System cost saving features 
      • Wide voltage operation 
      • Wide temperature operation 
      • Built-in safety features
      The RL78 MCUs‘ innovative “Snooze“ mode achieves ultra-low power by allowing ADC operation and serial communication, all while the CPU is turned off. This makes the RL78 MCUs best in class for low power applications.

      Monday, July 23, 2012

      Darlington Transistor Arrays

      After a bumpy period in my personal life, I am back on this project. Its going to be a bit slow over the next few weeks due to Ramadan, but I feel like I am excited to get the project back on track.

      The relay board did get assembled, but after finding a fault in the circuit design, Im having to fix it and make another revision. I have to say though, Im glad I came across this post on Adafruit about the ULN2003 Darlington Array, because that part (in its DIP or SMD packages) should allow me to shrink the dimensions of the relay board. 

      Also, if you're interested, RENSAS is offering a free promotion board for their new RL78 chip, to those who are willing to provide some information on the project it will be used in. They describe, “The YRPBRL78G13 is a promotion board for the new Renesas RL78 microcontroller family. It supports on-board debugging, flash programming, and is pre-programmed to work with the GUI provided on the included DVD to demonstrate the low-power capabilities of the Renesas RL78 MCU.”<via DangerousPrototypes >

      Thursday, June 7, 2012

      G8P Relay Controller Part 2

      Well I sent my boards off to the Fab shop, so hopefully they'll be in sometime next week.

      In the meantime, Ive started coding for the board to control the relays remotely. I've also begun work on the Relay control library to make coding a lot easier. The goal is to get a VB GUI program to interface with the relay controller to flip relays on and off. If that works, then the I'll try to make a Web server PHP script to control the relays remotely. As much as it is nice to have control over lighting at each station, the end goal is to interlink all these relay boards so that the Smart Home system maintains each system rather than the user. I've already begun making plans to make the next revision of these boards XBee Wireless.

      For the moment, I see a great need for single and dual relay controllers, but not so much for triple, quadruple or more relays per board. However, if the need arises, I can design larger sized relay controllers. Most people have one lamp here and another there; some just want control of their ceiling fans and lights. While the initial revision is dual relays, I see a future for making single relay boards. 

      I've decided to say a little bit (benefits) about why I've selected the Omron G8P Automotive relays:

      First, theyre capable of handling high currents at high voltages. An SPST relay can handle 30A at 220VAC, while an SPDT can handle 20A at 220VAC. That goes a long way for controlling devices in a home.

      Second, there are quick connect pins on the top of the relays, which allow an electrician to use quick connect crimp connectors to wire each relay into a lighting circuit. This is beneficial, since they most electricians are already aware of this connector, and probably stock up on them. 

      Third, the PCB board doesnt have to account for high currents running through it, so price of fabrication is lower, and thus price to sell a controller is lower. This is more a technical aspect, but its important for the user in that theres less of a chance of a fire in case of failure of the PCB. Fourth, these relays are already being used on production lines in manufacturing facilities and in automotive applications. They've proven their worth and their reliability. I can say from experience using these relays before in a couple of projects, that they never let me down. 

      So benefits all the way around. Finally, there's only one company I'm aware of that sells relay controllers with G8P relays. As their pricing stands today, the boards are way over priced, and totally unaffordable by electronic hobbyists. The plan is to make my boards affordable, and still try to give the same range of features. 

      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.

      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.

      Sunday, January 22, 2012

      Open CV

      Im going to step through a simple example with OpenCV 2.3.1 Mega Pack on Visual Studio 2010 and Windows 7 x64. I got the run around from searching around on the web for the past couple of days, so Im sure everyone will benefit from this solution.

      I followed several tutorials step by step, with some changes, and it finally works. You must make the changes to get OpenCV 2.3.1 working. I'll walk you through the whole tutorial, to guarantee you dont miss anything.

      Step 1: Install OpenCV 2.0

      Go to the SourceForge page of OpenCV and install OpenCV 2.3.1 Mega Pack for Windows. Install the package to 'C:\OpenCV2.3.1'. If you look in the directory, you'll see a folder called build. We need to use that compile OpenCV.

      Step 2: Compile Everything

      Before you start working with Visual Studio, you need to compile the code into a VS project. You can do that using CMake.

      Once you install, start up the command line prompt. (Win+R, type cmd and press enter). Type cmake and you should be able to see something on screen.

      Next, type in this line:
      cd C:\OpenCV2.3.1
      mkdir vs2010_build
      cd vs2010_build
      cmake -D:CMAKE_BUILD_TYPE=RELEASE C:\OpenCV2.3.1
      You’ll see a lot of things happening. And after a while, the process would complete, and you'll have a Visual Studio Project for OpenCV.

      Step 3: Compile the project
      This one is simple. Double click the OpenCV project, and compile it in Visual Studio 2010 (or Express). It’ll take a lot of time. Compiling the samples and the entire library itself takes a real long time.


      Step 4: Sample Project
      Then start a new instance of Microsoft Visual Studio 2010 ( or Express).
      • File -> New -> Project
      • Name: 'C:\Tutorials\OpenCV\OpenCV_Hello'...'OK'...'Finish'
      • Use the code below:
      // OpenCV_Hello.cpp : 
      // Microsoft Visual C++ 2010 Express and OpenCV 2.3.1
      
      #include "stdafx.h"
      
      #include "cv.h"
      #include "highgui.h"
      
      int _tmain(int argc, _TCHAR* argv[])
      {
              IplImage *img = cvLoadImage("lenna_small.png");
              cvNamedWindow("Image:",1);
              cvShowImage("Image:",img);
      
              cvWaitKey();
              cvDestroyWindow("Image:");
              cvReleaseImage(&img);
      
              return 0;
      }
      Now comes the important part. Pay attention to this, or you'll be dealing with the same errors I got.

      Step 5: Configure Project Directories
      • In VS 2010, Go to 
        • Project -> OpenCV_Helloworld Properties...Configuration Properties -> VC++ Directories
      •  Executable Directories -> use the drop down menu -> ... add: 'C:\OpenCV2.3.1\vs2010_build\bin\Debug' 
      • Include Directories -> use the drop down menu -> ... add: 'C:\OpenCV2.3.1\include\opencv;' 
      • Library Directories -> use the drop down menu -> ... add: 'C:\OpenCV2.3.1\vs2010_build\lib\Debug' 
      • Source Directories -> use the drop down menu -> ... add: 'C:\OpenCV2.3.1\include\opencv;' 
      • Linker ->; Input -> Additional Dependencies... [Use the top left drop down menu to find each build, i.e. where it says Active (Debug)]
        • For Debug Builds -> use the drop down menu -> ... add: 'opencv_core231.lib; opencv_ml231.lib; opencv_highgui231.lib' 

        • For Release Builds -> use the drop down menu -> ... add: 'opencv_core231.lib; opencv_ml231.lib; opencv_highgui231.lib' 

        • Ignore all Default Libraries -> 'No'  


      • Linker -> General-> Additional Dependencies -> use the drop down menu -> ... add: 'C:\OpenCV2.3.1\include\opencv;C:\OpenCV2.3.1\build\x64\vc10\bin;'

      Once you have these configurations, there is one last thing you need to do. This is a critical step, or the program wont compile.

      • Go to Build -> Configuration Manager -> Platform -> use the drop down menu to select x64 instead of x86.
      • Now Build the project, and it should compile pretty quick. Then just run the project via the Debug menu. And thats it! You should get an image box with your sample image.

      In my search online for OpenCV tutorials and code, Ive come across quite a lot of previous work. An image crop of Lenna for OpenCV purposes can be found here. The following websites were directly used (including images and code) for this tutorial:

      1. http://www.aishack.in/2010/02/hello-world-with-images/
      2. http://www.aishack.in/2010/03/installing-and-configuring-opencv-2-0-on-windows
      3. http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010
      4. http://stackoverflow.com/questions/7011238/opencv-2-3-c-visual-studio-2010
      5. http://abdullahakay.blogspot.com/2011/08/opencv-23-linker-error-with-vs2010.html
      6. http://siddhantahuja.wordpress.com/2011/07/18/getting-started-with-opencv-2-3-in-microsoft-visual-studio-2010-in-windows-7-64-bit/
      If you have no idea what OpenCV is or how to use it, I found a pretty nifty set of tutorials here to get you started on Windows.

      If you want to run OpenCV using Python on Windows, this blog will show you the way. If you want to run OpenCV using Processing and Javascript, this blog will help; this is useful for running OpenCV on the Beagle Board xM and the BeagleBone. The OpenCV Java library is here.

      One of the most useful tutorials that Ive found thus far has got to be the one by Sparkfun. Its not just an OpenCV tutorial, but it has a motion tracking pan/tilt camera with free code!

      I know these sites were very beneficial for my education of OpenCV and for projects, and I hope they help you too.