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.