Introduction: EasyLights

I was working on my Picaxe 28x2 robot from http://letsmakerobots.com/ and I wanted lights and I needed more sensors. I had four input pins left. With the 28x2 you can make the pins anything that you need.  I went back to electronics to find some answers. I looked up shift registers on http://www.jameco.com/  and I bought the latest CD74HC164 serial in parallel out. This is why I made Easy Lights. For two pins you get eight lights. Yes there is a little flicker. It is a shift register. Each time the lights change you have to shift in all eight lights. On slower systems you can use the Master Reset to clear the lights, but it still flickers when loading the lights.



Making the Easy Lights board at home is so easy now. Watch videos on the Web. I used the basic parts from Jameco and http://www.frys.com/ . Positive board developer, pre-sensitized positive 4x6 boards and ammonium persulphate for the etchant that I got at Frys. I have a florescent 15 watt exposer light and frame that I got at Frys.  You need to protect everything from the developer and the etchant.  The one thing you do not need is a safety light. I just closed my vertical blinds in my bedroom and put a towel over the bathroom window. Be careful with sun light and any florescent light. Instructions come with most boards.

You need Gloves, tongs, plastic bottles, plastic table cloth and trays. No metal anything. Mix everything into the bottles first. Do one thing at a time. Print my circuit using the PDF file. If you have a laser printer like me than print on the smooth side of the transparency film. Ink or Toner faces the copper or resist and you can read EasyLights. My exposer took ten minutes. The developing can also take about ten minutes. I agitated the tray and rubbed the board with my gloved fingers. I put the etching tray in another bigger tray filled part way with hot tap water. Etching takes at least an hour. I changed the hot water a couple of times. I agitated often. The boards came out perfect.

If you are going to use the Master Reset(9) then do not put in jumper three. The hole next to the chip by jumper two the Clock(8) is the hole to use. You do not have to put the Leds onto the board. The Leds need their line from their resistor and ground. This makes my board easy to use. The Leds will flicker less if they are not in line with each other.

My programs are just demonstration to show how my light board works. All you need is something like doLights or shiftout and maybe checkLights to run your lights. Programming can be fun. I left some mistakes in my Basic Stamp 1 (EasyLights1.bs1) program because they are very common mistakes. Look at tPause and note that it is a byte. When I changed timing to a variable I put the pause time of 3000 into my tPause and I got gunk out. Why? A byte holds just 255 in decimal terms. Processors like the Basic Stamps use 16 bit or word size for all math operations. When you put 3000 into a byte size variable you only get the low byte of the word sized of 3000. It is 184 or 10111000 in binary. The system tells you nothing for math errors like this. You see something wrong with your program. That is all you get.  This is a good example of a very hard error to find. Even I think that I can’t be that stupid.

DoLights is an example of programming for a device. A shift register like the CD74HC164 has three inputs Clock, Data and Master Reset that control the registers or lights in this case. You set Data to high or low and raise your Clock high wait and set your Clock low and repeat this for all 8 registers. To clear the lights you can load all 8 lights with Data low or bring Master Reset low wait and set it high. Master Reset needs to be high for normal operation. Most processors like mine are too slow to wait between setting the Clock high and then setting it low.

CkeckLights is my way of efficiently using the Bits of each of my lights for easy logical testing. Bits only have two values 0 for off and 1 for on. CheckLights sets litTmp to the Bit of each light. This makes testing easy. If litTmp = 1 then doLitOn. Simple. Most processors give you access to the Bits of the first few Bytes of memory. If you tested the Byte lights for Bit 4 light 5 you would get 16 the position value of that Bit in the Byte. Messy to say the least. Logic operators like And and Or would give you the Bit position value too. In Larson to set the high Bit of lights I set lights = 128 the value of Bit 7 the high Bit in lights. Binary shows how the processor sees your numbers in binary. Random numbers in a byte.

Position – value         Value or 0               Binary is Right to Left                 High to Low
Byte Bits:   7-128, 6-64, 5-32, 4-16, 3-8, 2-4, 1-2, 0-1  --  Bit 0 + Bit 1 = 3, Bit 2 + Bit 0 = 5

Easy Lights would be a great project to teach Electronics, Programming, Processors and making boards. If you are not making money on my ideas than have fun. If you make money than contact me, please.

My Programs ------- All of the files are in the Zip file
Basic Stamp 1 has a button and three modes. Larson, Binary and Random. I have an old original Basic Stamp 1 that I just bought a new carrier board for and a new Basic Stamp 1 project board.
          EasyLights1.bs1   Shows a couple of errors. See what you can find.
          EasyLights2.bs1   Fixed everything I think. Used pause 1000…. Added random numbers.
Basic Stamp 2 has a button and three modes. Larson, Binary and Random. Plus I run the over stuffing a byte error using the debug terminal. I will try to add a speed button. I have an old original Basic Stamp 2 that I upgraded its super carrier board with new headers and a cute mini breadboard. I also have two Sumo Bot Basic Stamp 2s that I am working on. I also have a Basic stamp 2 project board that is great for learning Basic Stamp 2 programming.
          EasyLights2.bs2  Getting started
          EasyLights3.bs2  Basics are done Button, Larson, Binary and random
          EasyLights4.bs2  Added the over stuffing a byte error.
          EasyLights5.bs2  Added a flag to turn off over stuffing a byte. Fixed Binary.

Picaxe 28x2 robot Picaxe has two buttons mode and speed. Larson, Binary and Random. This is where Easy Lights comes from. I am making a lights plus analogue board for my robot from letsmakerobots.com. This is a perfect starter robot for anyone. You get the Picaxe 28 board with an L293 motor driver chip. Two right angle motors with large wheels. A Sharp GP2D12 Infrared range finder. One full size servo. There are tons of ideas on the web site.
          easyLights1.bas

Arduino Uno with a Maker Shield and one button running Binary, Larson and random. I got my Arduino at the makezine.com store. Full kit with electronic parts, how to program Arduino book and a Maker Shield to build. I love C and that is what you program the Arduinos with. Note. The file extension has changed to ino with the new Arduino environment. It will still open pde files but it only saves as ino files. This is my favorite system.

           easyLights1.ino  getting started
           easyLights2.ino  cleaned it up and added a subroutine for Larson. I use the shiftout
                                      function. Perfect for a shift register. Fun.

Comments

author
Geek07Boy made it! (author)2012-08-08

Updated programs. BS2 using shiftout function. Picaxe programs are in this one.

author
Geek07Boy made it! (author)2012-06-19

I forgot my Picaxe 28x2 program file, sorry. I just updates the zip file.

About This Instructable

1,951views

4favorites

License:

Bio: I have always been a geek and I see things differently than most people. I am healthy too and I love biology. Programming has always ... More »
More by Geek07Boy:Fun Led Checker TesterFlying a toy QuadCopterServo Math
Add instructable to: