Saturday, July 11, 2015

Bug Out Bag/ Emergency Car Kit

So I know its been a long time since I've posted here, and it's mostly cause Ive lost interest in my Smart Home project. Between work and life, there's no time to spend on it, and what's more is that it's no longer a new type of technology. Lots of companies have similar products and my Smart Home project is no longer a viable option.

So Ive decided to move on to bigger and better things. This blog is still about Green Living, which includes safe, proactive and environmentally friendly topics. One of those topics that recently was brought to my attention is having an emergency Bug Out Bag (BoB) to have with you at home in case of an Emergency where you need to leave your home immediately (i.e. a fire or natural disaster). This is different from an Emergency Car Kit (ECK), which would have tools and supplies in case your car breaks down on the side of the road or you get stranded somewhere remote. This is my new project; In the next few months I'm planning to build up my BoB and ECK kits and I'll be sharing what sorts of items I'm going to have in them. 

Monday, July 7, 2014

Kitty Acquired

I know its been a long while since I last posted and I do apologize for that. Between work and getting a new kitty, this project has ground to a halt. I just have no time to spend on this 'Smart Home' project anymore. But I decided this blog will be all inclusive about technology, my project (whenever I can) and all other matters of my life that I see necessary to talk about. One such case is the new cat.

My Orange Tabby came to me mid-march, when the temperatures were way too cool for a kitty to be wondering outside in. She was homeless - a stray, wondering endlessly looking for a new home. She happened to be out when we'd had a bitter cold front, with temps dropping into the single digits. Meowing endlessly, she went door to door begging to be let in, when she finally came in front of my door. To her amazement, I actually opened up. She came running inside, investigated the whole apartment, and then looked at me for food. I, being a single guy, had no idea what kitties eat, let alone had any cat food to begin with. I gave her the next best thing: canned tuna with dill and olive oil. From the looks of it, she didnt care: she was famished. Now, visualize if you will, this is a full human-sized can of tuna. One can usually fill and satisfy most folks. She was so hungry, she not only ate one of them, she ate two! Plus she downed about a bottle of water to boot! I was so happy that I fed her, because from the looks of it, she was seriously underweight, with ribs easily showing through her fur. After the initial feeding, she was grateful for the meal, and started rubbing against me and purring. It didnt take long for her to want to go back out, which I complied. Not even 30 seconds spent outside in the freezing temperatures, and she ran right back indoors. Now I had me a kitty.

First thing was first: I had to bathe her to get the grime and dirt off of her coat. No way I was letting her sleep in my apartment or my bed for that matter, while she was dirty. Note: had I known the possible side effects to bathing cats, I would have never attempted this. I knew they didnt like water, and that she would most likely attempt to flee the bath, so I went in and completely forgot all the supplies I needed. I took her in the bathroom and shut the door behind me. First thing I did was try to calm her, which didnt really get me anywhere. She was anxious for being in a new location, and taking her with me into a smaller room seemed to aggravate that. For the moment though, she wasnt meowing, howling or angry, so I went for it. I turned the water on, attempted to set the temperature to something comfortable for me, and dunked her right in. Knowing now what I should have known then, dunking her was very silly of me for many reasons.

One, she could have freaked out and attacked me for doing that - thankfully, she did not. Two, she could have jumped out and made a complete mess of me and my bathroom - which this is exactly what she did. And Three, she could have caught a cold for having her fur whetted suddenly and without notice. Normally, it is recommended that if you wish to bathe your kitty, you need to prepare a small tub with some toys and slowly introduce him/her into it to try to "enjoy" the bath. Also, I used Head-And-Shoulders, since thats the only soap I had available. Apparently, theres some special kitty-safe bathing soap, I wasnt aware about. In any case, my soap did its job, because when I finally washed her off, the whole bottom of the bath tub was covered in soil/sand. Since I didnt have the forsight to get a towel for her, I had to use my bath towel to dry her off. Let me tell you, while bathing is one of the hardest things to do, drying off a wet cat is just as hard, if not harder. She doesnt want to sit still, shes soaking wet, plus by now you're probably soaking wet too, and all the while, shes getting cold. You have to work quickly, otherwise she will catch a cold, which involves taking her to a vet and getting some medication to help her out with that. Its a lengthy, painful process you dont want to undertake. So some speed in drying your kitty is required.

When I finally dried her off, her fur was matted down, and she began the long process of cleaning her own fur to fluff it back up. By this point, it was late into the night, and I was getting tired. I felt I owed her to care for her at least temporarily, so I brought her to my bed, and allowed her to bunk with me for the night. I was surprised just how accepting she was of the gesture. Just as I was starting to nod off, I noticed she had stopped licking herself and had dropped off as well. It made me smile, knowing I had not only rescued a kitty, but cared for her and helped her get clean as well.


Okay, since this story is really long, I'll save the second half for later. Thanks for reading!

Wednesday, September 4, 2013

Copyright Update!

Well after some thought, and a few cease-and-desist letters, I had decided to formally submit an application for a copyright registration of my thesis paper. This was back in March - its now September, and my registration has been approved! So now, only I am allowed to say if and when people can use from my thesis document any material posted in it, that includes drawings and schematics. All of it is copyrighted. :)

OK, now that I got that off my chest, onwards to the Smart Home project...

Alas, I havent made much progress with this since I started my new job. Work projects take priority after all, and I just dont seem to have it in me to work on this when I get back home on the weekdays. I dont even have my lab bench setup at my place, so I cant really begin to think about smd soldering or what not. However, Im still open to suggestions and input for ways to improve the project.

Thanks for reading. Peace!

Thursday, July 4, 2013

Regular Fixes to Linux

If you're like me, and you rarely use Linux, you tend to forget your password as well as other little windows interface fixes that are required quite often.

I hope this blog post is as useful to others as it has been to me. The following instructions are a combination of Linux Tips and Tricks and Brandon's Solution:

Linux Passwords

Lost Password? Dont Fret! Check This Out:

Switch on your computer, and as soon as you can, strike the Esc key on your keyboard to display GRUB menu (assuming it doesnt already take you to this menu on boot-up);

Highlight and select the recovery mode;

Your distro will boot into a recovery shell; 

Select the command prompt as root, then type:

user@pc:~$ passwd user

Where the user is your username; Choose, enter and confirm a new password when prompted.

If this doesnt work, I have a solution. Its not because you typed it in wrong. Its because the File System is mounted in Read Only mode which prevents resetting the password.

You'll have to change it over to be Read/Write Mode. Heres how to do that:

Choosing the option to remount / as read/write and going back into the root shell prompt enables the password change.
The command to run prior to changing the password is:
user@pc:~$ mount -rw -o remount /

Try again with the password change:

user@pc:~$ passwd user

Where the user is your username; Choose, enter and confirm a new password when prompted.

Restart your machine:

user@pc:~$ reboot

and take a deep breath.

XFace GUI

Next I have an issue with my XFace GUI where my Maximize, Minimize and Close buttons all disappear and the window title bar is missing. Its very annoying, since you cant close any of your windows, and you can end up punching your screen in frustration. Here is a temporary solution for that [credit to The Ubunt2 Forums]:

Click on the Application Menu to Execute a Program.

Type in 
xfwm4 &
and hit [Execute]. This should resolve your problems. 


Tuesday, May 7, 2013

Work Desk Galore

Hello again. 

Lately Ive been overwhelmed by projects and tasks at my new job, so I havent had the opportunity to make much progress on my own Smart Home project. On the brighter side, Ive got a pretty good idea of the work desk I want to order so that I can setup a work station at my new apartment.

Ive narrowed down the choices to two workbenches from Global Industries, both with Maple-wood tops. I didnt want an ESD-safe top, because those are plastic surfaces which arent very friendly to Soldering Irons. Traditional compressed-wood work tops arent very knife-friendly either. So the best of both worlds, a cutting board-styled top. Im not sure if I will add accessories to the work bench or not; first thing is first, Ive got to order the bench and assemble it at my apartment, before I can proceed.

Until next time. Peace Out.

Monday, March 11, 2013

Unauthorized Sales of My Thesis

Lately I have noticed a few stores selling my published thesis, Tesla Turbine Torque Modeling for Construction of a Dynamometer and Turbine, without A) asking permission from me, the copyright holder, through oral or written means, or B) giving me royalties for the sales. 

As this is a document provided free to download on the UNT Digital Library website, I expect it to be shared to the global community free of charge. BUT should it be sold, I expect to gain royalties as a result of these sales (though I still dont want to sell it).

I have seriously considered sending a Cease-and-Desist Letter to all of the stores attempting to sell a copy of my copyrighted material, and have already begun with a few of them. I have filed a copyright application to get the ball rolling legally in case I have to take this to court (hopefully I wont have to).

The following websites have already received emails about this, and should be taking action shortly to take them down:

Amazon.com

Barnesandnoble.com

As it stands, if you see this document, Tesla Turbine Torque Modeling for Construction of a Dynamometer and Turbineplease PLEASE DO NOT PURCHASE IT. I am not getting any Royalties, and these sales do NOT benefit me. 

You can download it for FREE from the original publishing location, the UNT Digital Library.

If you have any advice for me, please post away. I can use any advice on this topic.

Thanks for your understanding.

Friday, February 15, 2013

Slowed Pace, Little Progress

Well, the pace of the project has slowed down considerably since I settled down at my new job. As you can imagine, after a long day at work, one tends to just relax when one goes home, and side projects are the last thing on your mind. So this has become a weekend project pretty much. 

The boards returned from the Fab shop a few days after the New Year, but Ive yet to order the parts (or solder paste) because my work desk/soldering station isnt setup. Ive moved to a new place and I will have to acquire a proper work desk so to proceed with soldering in a safe manner. So pretty much the project is still on a hold until I can setup my work station.

Whenever I get a chance I may post some technical news posts, but until I get the work station, there wont be any updates for this project. Makes me a little sad, but my new job takes priority. 

Peace Out.

Thursday, January 10, 2013

Google Code Page Online

Just wanted to update the latest and greatest on the project. For the moment, the entire project is on a temporary hold while I move to my new place and get situated at my new job. In the meantime, the boards have been at the Fab shop for over a week, so I should be getting them soon. My parts list is completed, so I'll go ahead and put that in my order queue.

For the moment at least, Ive got my Google Code page setup, so any code, updates, open source what not will all go there. If you have any input for this project, feel free to post in comments on this blog. I will investigate the need for a Google Group in the future, but as I see it, there is not quite enough of a following to justify that for now.

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.