Let's Make Robots!

EasyLights

Eight Lights with two pins Clock and Data
AttachmentSize
EasyLights_20_PCB_layout.jpg121.06 KB
EasyLights_30_bb.jpg89.67 KB
EasyLights_40_schem.jpg55.38 KB
EasyLights.pdf91.13 KB
EasyLights_43_BS1_new.JPG129 KB
EasyLights_45_BS1_old_.JPG148.98 KB
EasyLights_58_BS2_old.JPG159.16 KB
EasyLights_76_BS2.JPG216.18 KB
EasyLights_85_Arduino_Uno.JPG87.88 KB
EasyLightsv6.zip220.03 KB

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

It is hard being a geek because no one ever understands you. Cities like LA can be so image oriented and stupid that there are no computer clubs for regular Joes. I wish I had friends that I could share this with. Being healthy also helps you enjoy your projects. That is why I get up and go for regular walks to get me out of my room and to take care of my body. I know how lost I can get in my projects. Geeks have hearts too and petty normal lives.

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

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.

All of the files are in the Zip file.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

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

i updated the zip file.

Enjoy

If you want to eliminate the flicker then use a serial in, parallel out shift register with a latched output such as the 74HC595. The advantage of a latched output is that the output does not change when you update the data. Admittedly you need to use another I/O pin to update the latched output but you can link 2 or more together to give you aditional outputs.

You could also consider "Charlieplexing" your outputs for driving LEDs.

Many chips make good lights. My Arduino Uno is fast enough to to not notice any fickers.

Thanks

 

Well, it seems you did a nice work here (i like the attached pictures for more visual understanding). I am almost ready to use the shift register very soon too and need some startup :-) Your explanations seems right for me to try...although I am using Attiny's :-)