Wednesday, May 4, 2011

Back to work...

Sorry for the delay in getting to the next project but I can now share with you why I've been a little tardy. I was asked by Make: to host a new video series called "The Latest in Arduino," and it's taken a bit of my free time to get it rolling, but now that episode 1 is out (and raw video for episode 2 is submitted) I can get back to the Beginning Arduino projects.

Before I move on to the robot project, I needed to solder up the MotorShield. It wasn't difficult, but look close and you may see an error I made... it's not critical and I can still work with it, but it'll always stick with me as a reminder to go EVEN SLOWER when soldering up these shields!

Now that the MotorShield is done, I need to solder some wires to the motors on the robot base... so I'll try and tackle that tonight so I can get another project completed before Friday.

I'm also going to be attending Maker Faire in San Mateo, California, in a few weeks... if you're going to be there, come by the MakerShed tent - that's where you'll find me. I've been asked to tag team between my own booth (showing off the 3D Printer that goes with my new book "Printing in Plastic: Build Your Own 3D Printer" with my co-author Patrick Hood-Daniel) and a booth where visitors can test out the MintDuino and wire up a few cool things. Should be fun.

Sunday, May 1, 2011

Learning Processing Blog

It's always nice to find a fellow blogger working his or her way through a book and documenting results, good and bad. Related to the Arduino, I'd like to point you to Will Price's blog where he's currently working through both the Make: Electronics book and Learning Processing, a book certain to be of interest to all of us just learning to code for the Arduino.

Tuesday, April 26, 2011

Arduino Books - 50% One Day

O'Reilly has a one-day 50% eBook sale for its Arduino titles... you can find more information here. I've been going through the Arduino Cookbook, myself... it's a worthy title for your bookshelf, and at 600+ page and tons of sample code, it's well worth the $16 price today.

Wednesday, April 20, 2011

Stepper Issues

This stepper motor is driving me crazy... I've tried all the iterations (I think) and it gets power, the axle won't rotate, it buzzes... but no rotation. I'm going to spend a few more minutes with it tonight... maybe tomorrow... and then move on to the robot project which is next.

I've checked my wiring... double-check it... it's not the wiring. I'm pretty certain something weird is going on with this motor. I have a LOT of stepper motors (4 for my 3D printer and 3 for my CNC machine) but they have unique connectors that I'd have to cut and I'm not going to do that for this project... these are BIG steppers and not cheapies at all.

In the meantime, I've got to solder up a MotorShield that I'll be using for Project 29... will try to get to that tomorrow...

Saturday, April 16, 2011

Project 28 - Need Some Help - UPDATE

For those of you with access to the book and/or a better understanding of the Uno, I have a question - Figure 10-1 shows a wire running from what appears to be a numeral 9 near the 5V and GND wires at the bottom left corner of the figure. This wire goes into the positive power column/row at the top of the breadboard which then connects to the stepper motor.

On my Uno, this is labeled Vin (I think) - the author says to use external DC power for this project so I'm wondering if that's how power is being applied to the motor. It's just never been mentioned in the previous projects so I'm a bit confused.

Also... a bit of checking online reveals that the Uno wants a 9V AC-to-DC power supply adapter which I don't have... but I do have a variable one that can be set to 9V. The only problem is I cut off the end to expose the wires for the Make: Electronics book (so it can be plugged directly into the V and GND breadboard rows). I'm thinking I should be able to just plug in the Arduino to the USB for its own power needs and, while still running the 5V and GND wires from the Arduino to the breadboard for the chip's power needs (5v or less I'm guessing) I can just skip the "9" or whatever that is and provide power to the motor with my variable adapter's leads... right?

Update: And wouldn't you know I'd buy the one stepper motor that doesn't seem to have any kind of help in terms of data sheet when it comes to sorting out the six wires and what goes where! Argh...

Friday, April 15, 2011

While I Wait Some More...

Still waiting on the servo so in anticipation of an upcoming project involving building a line following robot, I decided to go ahead and put together the 4-Wheel robot base that was loaned to me by MakerShed...

It's a solid base... this thing is designed well. I did find that the online instructions for building it didn't match up exactly to the parts I have (the black metal frame pieces are slightly different in the number of holes but that wasn't a problem) and the photos don't really show the motors being held to the frame with the long machine screws that came in my kit... but it's not difficult to figure out anyway.

The upcoming project uses a 2-wheel robot frame along with a caster, but since I have a 4-wheel version I'll probably have to modify the code a bit to control 4 wheels... or just hike the base up on a home-made caster of some sort... will cross that bridge later... I may actually break down and buy this thing from MakerShed as I can see it being a really nice base to have for future projects... BTW, there's a bunch of small add-on parts for holding sensors and such that I haven't attached in the final image here.

Wednesday, April 13, 2011

While I Wait...

While I wait for a little cheap-o stepper motor to arrive for the next project, I thought I'd share with you something Arduino-related that I just got my hands on - it's the MintDuino from MakerShed... and it's totally cool... and really fun to build.

Everything you see there on that little breadboard fits in that tin. The breadboard actually folds up - the power/GND columns fold back and then up to snap into place, making it fit nicely in the tin, too. It took me about 20 minutes to assemble using the instructions over at MakerShed, and it's not as "user friendly" as a real Arduino due to the lack of labeling... but that, to me, is where the fun begins.

I took the MintDuino and began comparing it to the Uno... I used the circuit tracing that you can see on the surface (front and back) of the Uno and was able to determine which pins are which on the Atmel chip. If you want to gain a little better understanding of the Uno's circuitboard, build your own MintDuino and things start to click. (Not everything... I'm still learning and figuring things out - there's a lot more I don't know than what I do know...)

Blocked Comments - UPDATE

I've received word that commenting may have been disabled on this Arduino blog... not sure what happened there, but I've made a change to the rules to allow registered users (and OpenID users) to post comments.

The old setting was "Anyone" and one day I woke up to find the same spam comment posted on every post in this blog... that's what forced me to change it to Google account users... that may have been the problem.

I hope this fixes the issue, and I apologize if anyone has posted comments that didn't make it... I'll watch this for a few days, but if a few readers reading this will try to post a simple comment to this post just so I can verify it's working, I'd appreciate it.

UPDATE: I got a lot of comments today so I think it's working again... I'm going to flip it over to accepting comments from EVERYONE (no special accounts needed) but I'm going to turn on moderation so I approve comments first... that way I don't wake up to 50 comments appearing from spammers! Thanks, all, for your understanding and patience as I worked this out.

Thursday, April 7, 2011

Project 27 - Joystick Servo Control Part 2

It didn't take me that long to solder the six wires to the joystick, so I went ahead and plugged it in to the circuit I made in Project 26... pushing the joystick forward or backward causes one of the servo motors to rotate ... pushing the joystick left or right causes the other servo to rotate.

The code is also fairly straightforward and easy to understand... I can totally see how you can create remote control devices using a couple of joysticks and servos. (Notice I said devices, not robots - I'm still in that group that believes any device that is tethered to a remote control is NOT a robot... a debate for another day.)

Now - a question - in the code each potentiometer has a value that is read between 0 and 1023... that's a 10 bit number if I'm correct. This number is then "mapped" to a value between 0 and 180 for the number of degrees to rotate. So... why 1023? Do the potentiometers send a 10bit signal that represents direction and rotation? I'm still trying to understand that little bit of code... any help out there?

Two videos below... first shows a closeup of the joystick I soldered up... second shows Project 27 in action.

Project 27 - Joystick Servo Control

I purchased two of the COM-09032 joysticks from Sparkfun for Project 27... they were only $4.00 each and looked like they'd be fun for a future project so I grabbed them. (I just hope they work - reading through the feedback on Sparkfun seems to indicate a lot of folks are finding them to be broken.)

Here's a data sheet for the joystick. But it's really quite simple if you examine the undersides... the two I bought have a pushbutton switch which is easy to find and easy to figure out which pins belong to it... that leaves six other pins (2 pairs of 3) - and knowing these things work like potentiometers, it's also easy to see how the 3 pins for each potentiometer (each pot is an axis for a joystick) work. Of course, I now need to solder some lead wires onto the ends so I can make them work with the breadboard... so I'll do that tonight and try to get to Project 27 tomorrow.

Wednesday, April 6, 2011

Project 26 - Dual Servo Control

This is an extremely simple project to put together - and I love it. I've had this idea in my head for a while to build my own humanoid robot with servo motors and now that I see what's involved in terms of programming I'm not so worried... I think now I'll be able to focus on the design and how the servo's are mounted and interact.

One thing I like about all these servo motors I'm seeing is how much standardization there is with wiring and mounting options (screw sizes and such).

I've got another project I'm working on right now - co-authoring a book titled "Printing in Plastic: Build Your Own 3D Printer" with Patrick Hood-Daniel. The book should be out in mid-May (just in time for Maker Faire in California where Patrick and I will be demo'ing the 3DP and showing off copies of the book... maybe selling copies if MFaire lets us) and I can't wait to start using it to prototype mounting brackets for my own robot...

Anyway... Project 26 worked - the video will show you how you use the Serial Monitor to send L and R (left and right motors) values, 0 to 180, to rotate the servos. Fun stuff.

Monday, April 4, 2011

Half Way!

Well... I just finished Project 25 which puts me at the halfway mark. Plenty more left to do, but I'm happy to say that I'm learning a lot, especially when it comes to programming. I certainly don't expect this book to teach me every aspect of coding with this language, but I'm amazed at what I'm picking up from the author's explanations of the code - I have to give the author large praises for taking the time to really go over the code - so many books (not just Arduino ones) that I've used in the past simply give you the code and you're just to trust that it works and not get curious about diving into it.

Project 25 is an interesting halfway point for me, as well... I like humanoid robots like the Robonova-1 and I have this itch to design my own one of these days using servos... I could totally see building a custom robot using an Arduino and servos... could be fun.

So, thumbing through the book I see I have some more interesting projects ahead - the RFID and Ethernet chapters are of interest, too, as I have some ideas for some home monitoring activities that I'd like to investigate.

So... thanks for sticking with me as I continue to work through the book. I haven't heard from very many of you about whether you've got the book and are working your way through the projects... let me know if you are and where you are! If you're ahead of me, I think it might be nice to have some guest commentary for some of the later projects... just a thought.

(And, well... because it's just my way... I'm already hard at work trying to figure out what to do next when I finish this book - what can my next hands-on project be? There are some front-runner ideas, but I'm open to suggestions, too...)

Project 25 - Servo Control

Project 25 was fairly easy to wire up and the code is extremely easy to follow. I'm really beginning to appreciate libraries... they make programming the Arduino so much easier. Calling functions by associating them with an object you've created is starting to sink in...

With the delay set to 15ms, the response of the servo turning is almost simultaneous with the turning of the potentiometer. In a second video I set the delay to 1000ms (1sec) and the delay is noticeable... turning the potentiometer in small increments can cause large jumps in the rotation of the servo... not sure when this would be beneficial, so I understand why the author chose a short delay. (But why not a 0 second delay? Hmmm....)

I have a very small servo that has a see-through plastic case... it has the same size motors I used back in Chapter 5 but it has gears that increase the power (or torque?) substantially... pretty cool to see gearing this small driven by such a small motor.

Project 24 - LCD Temperature Display

I added in the pushbutton and temperature sensor to the circuit I built for Project 23... after powering it up, I do get the readings on the screen for both Celsius and Fahrenheit but the numeric values are obviously incorrect.

I consulted the data sheet for the temp sensor but the calibration instructions are confusing and also they're for the "can" version of the sensor and not this extremely tiny sensor I purchased from Sparkfun... not sure if the sensor is defective but I know it's not 211F in my house.

I'd like to figure out why it's not working but without a way to verify the accuracy of the sensor, I'd rather move on to the next project. I'm going to leave the circuit alone for a day and see if anyone has any suggestions... I may also consult the data sheet again to see if I missed anything.

Sunday, April 3, 2011

Project 23 - Basic LCD Control - Error in Book - Fixed

After some frustrating time spent looking over this circuit, I finally figured out the problem. Figure 8-1 does NOT show pin5 on the LCD being connected to GND. I'll take partial blame for this, however, because on page 172 Table 8-1 clearly shows to connect pin5 (R/W) to GND. I had to consult the data sheet to confirm that pin5 was R/W, but after doing that it was a simple matter of using a jumper wire to get it connected to GND.

Video is below - as you can see, I got the contrast to work by adding in the recommended potentiometer. That's a 5k, btw, not a 10k. Also the resistor for pin16 on the LCD is brown-black-black - a 10 ohm resistor. I got this 16x2 from Sparkfun, part # LCD 09054

So... Project 23 works... which gives me hope for Project 24 since it simply builds on this circuit a bit.

Saturday, April 2, 2011

Project 23 - Basic LCD Control

Apologies for the long delay in posting... I'm currently writing 3 books and all of them seem to have had major chapters due on the same day this past week... and before you say "Are ya crazy?! 3 Books!" - I've got a fourth book that started yesterday and a fifth book looking to start in a month. It's insane. (Fortunately 2 of my current books are looking like they'll finish in the next week or two... but still...)

I've also been working on a "very special project" - Arduino-related, of course - but I can't talk about it just yet... probably will be able to announce something in a week or so, but you'll understand why I've been slow to getting to Project 23.

And I've been looking forward to this project! I have various ideas for Arduino projects of my own, and many of them involve being able to read text on a screen. I read over the code for this project and it makes sense... I really like being able to use an existing library to call on functions rather than code them...

In a previous project, the code was provide for scrolling text on the 8x8 LED display... that's a lot of code to sift through, and I understand it (sort of)... that's what makes this library so useful - rather than have to code the part myself for moving text left to right ... or right to left... the LiquidCrystal library has functions you can call on that take your text and perform these same operations, but you don't have to reinvent the wheel.

One thing you need to know about Project 23 - if you buy a similar 16x2 LCD you'll need to solder some wires onto the open hole leads in order to make it work with your breadboard. I soldered only the wires I needed (to match Figure 8-1) and left the rest open...

That said... I still can't get the project to work! Learning electronics has likely taken at least 1 year off my life expectancy... it can be SO frustrating. I've gotten good at not getting stressed after the first time running a project... over time, I've figured out that 90% of the time it's an error on my part. And it may very well still be an error I'm overlooking, but I just cannot get text to display on the 16x2... it's getting power... the backlight is lit, and I've played with half a dozen resistor configurations trying to find the right contrast... but no luck.

Suggestions are always welcome! Video below showing my circuit and the lack of progress... I'll keep messing with it for a day or two before moving on...

Tuesday, March 22, 2011

Project 22 - LED Dot Matrix Display - Pong Game

After downloading the LedControl library and extracting it into the Arduino library folder, I uploaded the very simple program for project 22 to my Arduino. The only modification I made to the circuit built in Project 21 was adding the single potentiometer... mine is a 5k instead of the 10k specified which seems to make the response a little bit less reliable... no big deal as I totally understand the program and how it works.

I really have a new appreciation for those old-time programmers who had to code up all this stuff with limited memory, limited video controls, etc... makes all those years play Atari 2600 games seem even more fun.

An 8x8 LED is definitely going to limit what you can do in terms of games, but you can see how a larger display such as the LoL Shield expands your opportunities. I'm now looking forward to learning more about the LCD screen in the next chapter as it has a higher resolution and, apparently, less wiring and coding to get stuff displayed properly. (Reading ahead, I'm hoping that my 16x2 LCD is compatible with the HD44780 driver the author mentions in Chapter 8. Will find out shortly)

Below is a video of the Pong Game... trying to control the paddle with one hand while holding the camera is difficult, so don't laugh at the results!

Friday, March 18, 2011

Project 21 - LED Dot Matrix Display - Scrolling Message FIXED

This project's been driving me crazy... the code makes total sense and I couldn't find any errors with my wiring.

So I just knew it had to be a bad chip or a bad 8x8 display... because there's simply no way it could be my mistake, right?

Well, if I'd looked at the very small writing on the side of the 8x8 display I would have seen the letters TA15... on the other 8x8 are the letters TC15... I wonder what those letters mean?

This project calls for a Common Cathode... with a C. Earlier projects used a Common Anode 8x8... with an A. Hand. Hits. Head. Hard.

So, here it is... with the proper 8x8 display installed... and working fine.

I'm going to go to bed early tonight.

Wednesday, March 16, 2011

Project 21 - LED Dot Matrix Display - Scrolling Message

In the continuing story of 8x8 LED displays not working for me, Project 21 is no different. I've checked, double-checked, and triple-checked my wiring and can find nothing wrong with it.

I'm using the C- display as specified, but all I can manage is to get a nice little light display on the 8x8. There is something going on... just not sure what it is.

There also was a little bit of extra code in the program that I had to remove and fix in order to even upload the program to the Arduino. I'm including a screen capture here - there's a small symbol indicating wrap-around of the code... remove it, hit the delete key to pull the little bit of wrap-around code back to the previous line... and the program at least uploads properly.

I also did a side by side comparison of the data sheet for my 8x8... compared it to the author's and it's identical (see screen capture). You can view my data sheet here.

I'm using the small 8-pin headers to raise the display off the breadboard - I've made certain that all the pins are connecting properly but given that all the LEDs light up, I don't think there's an issue with the headers. My best guess is a wiring problem that I'm just not seeing or maybe a damaged IC, although I was very careful when handling the MAX7219 chip.

I'm going to play around with the wiring a bit and take a more detailed look at the data sheet as I think that may be my issue.

Tuesday, March 8, 2011

Project 20 - LED Dot Matrix Display - Scrolling Sprite

Well, I feel much better today - I was able to rule out my wiring, chips, and 8x8 display as the problem. I was reading ahead into Project 20 that uses the same wiring setup as Project 19. I took a chance and loaded the Project 20 program and - BAM - it works! (See first video below.)

Next, I copied a fresh version of the Project 19 code from the zip file containing all the book's programs (just in case I'd accidentally modified the code or something)... after loading it, I got the same error - a single flashing row along the top of the 8x8 display (see second video).

means that the program for Project 19 definitely has an error... but I've gone over and over it and cannot find the mistake. Maybe a reader can spot it?

Either way... I'm happy that Project 20 is working and it's a fun little exercise to go over. I've always wondered about "sprites" and "multiplexing" when it comes to game design (I've heard the terms often) and I think my understanding just increased a good bit.

BTW - Project 19 text describes the program as displaying a heart and then inverting it (page 132, 3rd paragraph under "Enter the Code") - but if you look at the actual program, the sprite stored is just a box in a box... the ones represent solid lines so you'll see there's an outer box made up of the outer LEDs and then a smaller inner box. Not sure if this is a major error in the book and means that the actual working program for Project 19 wasn't included (heart) but this box-in-a-box program was inserted in its place.

Sunday, March 6, 2011

Project 19 - LED dot Matrix Display - Part 2

I ended up using a set of headers to raise the 8x8 display about .5cm off the breadboard... it was just enough to allow me to use my jumper wires (the non-flexible ones).

My next task was to upload the Project 19 code... I did that and only the top row of the display lit up... and it was very faint. Not sure what was going on, I took off the display and went to work checking all my wiring. The next time testing the display... still no luck.

It occurred to me that the only difference between Project 19 and the previous Project 18 was I was simply dealing with more LEDs. I had a hunch, so I loaded up the Project 18 code and wouldn't you know it... the display worked great! Watch the video - just pay attention to the top row and nothing else... you can see that it starts out with all LEDs lit up (value 255) and then counts down in binary to 0...

So, a few things here - (1) my wiring must be at least partially correct or I wouldn't have that kind of behavior and (2) because you can almost see the pattern in the vertical (column) orientation as well (watch the last column in the video - farthest from the left), I believe that both 595 chips are working properly.

So... why isn't the code for Project 19 working? Not sure... I downloaded the TimerOne library, created the TimerOne folder, and put the files in it... no errors found when the code downloads, so it must be finding the library, right?

I'm not sure where to go here - I'm wondering if there might be something wrong with the author's code... I doubt it, because so far all the programs appear to have been well tested and I can't imagine a tech editor for this book not verifying all the programs and that they work. One issue I did have was that the author uses TimerOne for the library name but you can see "Timer1.xxxx" in the code... I'm not thinking this is an issue, but I can't say for certain.

Any ideas? I'm going to go and check my wiring one more time, but I just can't see that being the issue.

Friday, March 4, 2011

Project 19 - LED dot Matrix Display - Part 1

I'm quickly learning that when you work with electronics it's best to do so when your frustration level is low...

Thankfully, when I opened up my new box of goodies from SparkFun (who, once again, managed to package 10 items in a 4"x5" box - love it), I was in a good mood. Here's what happened from there...

First, I found the data sheet for my 8x8 Dot Matrix Display (C+) - feel free to take a look at it here. I'm including a few screen caps here of the data sheet to show you that the pin layout matches exactly the one that the author provides on page 132 in Figure 7-2. Woo Hoo... I won't have to worry about modifying the code due to pin differences.

Next, the data sheet was very clear on how to find pins 1-8 and 9-16... the small display has two notches that are raised and two notches that are recessed. If you turn the display so that the two raised notches are on the S and W edges, pins 1-8 are on bottom and 9-16 are on top.

Once I figured that out, that's when I hit the bump in the road... as you can see from one of my photos here, when you insert the display on the breadboard, the pins are inserted at the topmost set of pin holes and the bottom-most set of pin holes, leaving no holes for jumper wires. Figure 130 shows the display with two rows of free pins below the display and one row of free pins above the display... and that's my problem. Not sure if the author actually had an 8x8 display that didn't come in a shell like mine or if the display found in the program, Fritzing, doesn't take the shell into account when it comes to proper spacing... either way, I'm unable to wire up Project 19 until I find a work around...

One option is to solder some longer wires to each of the pins on the display and then I can insert these and leave the display free-floating off of the breadboard.

Another option I'm considering is using headers (I have a bunch from the Make: Electronics book project) and solder wires onto those - this would save my display's pins and leave them unaltered.

Thoughts from my readers? Any other suggestions?

Saturday, February 26, 2011

Shopping List - Feb 26

A quick check of ACK's online catalog revealed they are out of stock on the HC595 chips. So, online shopping I go...

I figured I'd try and spread out the cost of shipping by buying additional items needed later in the book. Sparkfun seemed to have quite a bit of the missing components (many of them high $ - bleh). So, I've updated the Projects Spreadsheet with a list of the items I've purchased along with costs.

When I'm done with this blog, I'm hoping to be able to offer up potential readers some sort of ballpark price for what they'll spend to do everything... still not certain if I'll break down and buy the Arduino Mega needed for Project 31 and 32. The author states that the standard Arduino can be used and explains how, but it's a bit beyond me right now and I'll cross that bridge when I get closer to Project 31.

In the meantime, as I wait for UPS Ground to deliver my goods, I'll probably go ahead and solder up the LoL Shield and the MotorShield that MakerShed sent me on loan... and document the work in one or two upcoming posts. Project 19 is temporarily on hold until then...

Project 18 - Dual 8-Bit Binary Counters

Looks like I'll be paying a visit to my local electronics store on Monday... I believe that one of my 595 chips is damaged. Let me explain.

I wired up the circuit as shown in Figure 6-4... it's a fairly logical layout if you understand Project 17. When I fired it up, I could get the LEDs on the left (sorry, I had to use all red LEDs) to start counting down from 255... but the LEDs on the right (connected to new 595 chip) weren't lighting up.

I tried quite a few things:

1. I switched out the LEDs with a few random ones (green, yellow, red mix) but no luck.
2. I switched out the LEDs on the left (that I knew worked) with the ones on the right... no luck.
3. I reversed the two 595 chips and the LEDs on left stopped working but ones on right did work.


Then I went back to my wiring... just in case. The wiring was fine, but given that swapping the 2 chips also reversed the LEDs lighting up, I'm fairly certain I've got a damaged HC595. But it's my fault... when I was inserting the 2nd HC595, one of the pins got bent... I used my small pliers to fix it. But after removing the chips numerous times with small bends in various pins, I'm certain that one of the 595s has died at my hands.

RIP HC595 #2...

This also means that Project 19 is on hold until I can get a replacement. Scratch that - if I can find them locally, I'll likely buy 3 or 4 to have extras. And I'm going to invest in a chip puller.

On a different note... my wife got me a Hakko 936 solder station for Valentine's Day (yes, she's pretty awesome) that I've been playing with and loving. It's got a dial-in temp gauge on front, however, that's been tricky for me as the documentation came with nothing related to finding the proper temps for solder.

I was in ACK Electronics last week to get a few spare tips (should have bought some spare 595s!) and mentioned the issue to Scott who works there... he pulled out this great little card (from 1977) that, among other things, has a sliding scale that allows you to find the melting temp in C and F for different mixes of solder. Look at one of the photos and you can see that I've selected a 60/40 mix of tin/lead and the guide gives me a range of 361-374F for the melting temp. Scott gave me the card to keep and it's now sitting next to my 936.

Wednesday, February 23, 2011

Project 17 - Shift Register 8-Bit Binary Counter

I enjoyed this project... for the first time in a long time, I finally understand how this type of chip works. I've encountered it before in other circuits, but there's never really been a good explanation for how it gets the data in there, holds it, and then knows when to release it.

The author covers quite a bit here, so I read the project text over twice before beginning. I already had a strong understanding of binary, so that part was easy enough to follow, but the explanation of Latch, Data, and Clock pins took an extra read... but it was worth it. Make sure to step through Table 6-4 on page 117 if this confuses you... that table really helped.

Not sure if the binary value the author uses at bottom of page 117 is an error or not, but it only shows 8 bits as 0011011 and the author references a Logic Analyzer figure on page 118 that appears to show the binary value of 00110111 for a total of 8 bits... maybe I'm wrong, but can someone else take a look?

The code is fairly easy to follow, but I had to really pay attention on the bit shifting portion of the code to understand what's going on there. It's an interesting project and the code totally makes sense now.

The video shows what happens when it's plugged in - I didn't record the entire count up from 0 to 255, but it does eventually light up all the LEDs for a value of 255!

Monday, February 21, 2011

Project 16 - Using an L293D Motor Driver IC

Well... a LOT to write about regarding Project 16. So, in no particular order, here are some observations, notes, etc.

* I used the SN754410 IC in lieu of the L293D. The author reports the L293D chip builds up a LOT of heat, but I didn't really encounter that problem. It may be either because I didn't let the single motor run for more than 20-30 seconds OR the small motor I'm using may be a factor... just don't know.

* Reader ctdahle provided a comment for Project 15 that clarified the issue of motors requiring their own power supply and not pulling from the Arduino. Understood, and thank you for clearing it up! This time around, I put in a single 9V battery (see photos) that I felt would do the job.

* Although it isn't easy to tell from Figure 5-3, the IC chip needs to have pin 1 pointing left... towards the Arduino. You can figure this out easily enough with the program and the pin layout on page 109, but I figured I'd save you a few seconds and tell you.

* I tried to use a heat sink that I purchased for this project... it slides over the IC and makes contact on the top of the chip. The problem was that with the heat sink, I couldn't insert the chip into the breadboard. I also tried a 16 pin socket (see photo of socket and heat sink) but the heat sink also prevented the chip from being inserted into the socket. The author shows what appears to be a heat sink that must require the chip paste but I couldn't find that particular item at or (A quick search of - the author's werbsite - didn't show anything for "heat sink" either, so please tell me if you find it and where.)

The program works fine... I am able to flip the toggle to change the direction of the motor spin. Once again I have to crank up the potentiometer quite a bit to get spin, but once it's spinning and I flip the toggle, you can hear the motor stop for a moment and then start up spinning in the opposite direction. (Not sure what the purpose of the 10k resistor is on the toggle - can someone offer an explanation? It looks like it's simply serving as a pulldown resistor... but no mention in the book.)

I was going to attempt the variation of this project (see page 109) but I'm including a closeup photo here of one of my tiny DC motors. As you can see, the wire has broken off... the leads on these tiny motors just can't hold up to even the slightest of tugs... will have to re-solder a stronger wire soon.

Sorry for the rat's nest of wires again... I simply love these flexible jumper wires and I'm not really trying to use any kind of color coding right now... maybe later. That said, if you look closely at some of the photos, you'll see I didn't follow the author's wiring diagrams exactly - the 9V positive wire connects directly to the chip... same with the motor wires. I just basically ignored where the author used jumper wire to continue a connection elsewhere.

Video below... you can hear the change of the motor when the toggle is thrown.

Wednesday, February 16, 2011

Project 15 - Simple Motor Control

You need to read over this project carefully - the author does a good job of warning you about the risks to your DC motor if you don't take care to provide the right amount of power to the motor. That said, I ordered a tiny motor that the Arduino is capable of providing power to (without an external power jack plug specified in the hardware listing) as long as the 10K potentiometer is thrown into the mix.

If you're not certain what you're doing, then wire up the project exactly as described in the book - he shows two AA batteries providing the power but if you have a variable voltage wall adapter, that could likely be used if you set the voltage to a level that matches your DC motor specs.

So... as you can see from my photos (and video), I've skipped the power jack and I have my DC motor getting power directly from the V+ line on my breadboard that, in turn, is getting power from the Arduino when plugged into the USB port. Maybe over time this would be a bad thing for the little motor, but for short bursts like in the video, and with the 10K cranked up a bit, it's not a problem. (And at $1.95 each, if the motor dies I won't lose too much sleep.)

I did use the specified 1N4001 diode in my circuit as well as the TIP120... I also removed the MakerShield to give myself a bit more room on the larger breadboard to spread out and wire it all up. I could easily have wired all this up on the mini-breadboard on the MakerShield now that I look at it, but I liked having the room to spread out.

In the video, when I apply power, there's a slight hum coming from the motor... only when I crank the 10K down a substantial amount does the motor start to spin. I put a piece of tape on the motor shaft so you can see the spinning action... it happens fast in the video before the tape is spun off... so watch carefully. Also not sure if you can hear the hum of the motor, but it's there, too.

Friday, February 11, 2011

Project 14 - Light Sensor

I've double and triple-checked my wiring - and I've switched out the resistor for values between 1K and 10K, but so far I'm not getting any variation of the Piezo when I cover the photoresistor (LDR) or shine a bright LED flashlight on it. You'll hear the Piezo in the video - maybe you can hear a difference, but the tempo sounds the same no matter what I try.

If anyone has any suggestions, I'll keep the circuit intact for a day or so before moving on to Project 15.

Meanwhile, in anticipation of some upcoming projects, I contacted some friends at and inquired about getting a "loan" of some parts that I'm hesitant to purchase right now - these two parts are the MotorShield and the Robot Chassis (base) that will be needed in Project 29 (Chapter 10). The folks over there were kind enough to send over the items for me to use (may be a few weeks before I get to them) and I just wanted to say thank you... and that I'll return them in good condition when I'm done. (The MotorShield requires assembly - another test of my soldering skills coming up - will share photos and results when I get it finished.)

Interestingly, they also threw in a couple of other items to test ... one is the Mintronics: Survival Pack which is very nice. I actually took the LDR out of it and swapped out the one in my video, but the results were the same. And finally, they've loaned me a LoL (Lots of LEDs) Shield which I'll play around with in Chapter 7 when I learn how to use the Arduino to control displays... should be fun.

It's probably no surprise that I'm a huge fan of Make magazine and - both resources are helpful to the hobbyist and I've found the folks working for both to be supportive and extremely generous. Be sure to throw them some business if/when you can - I've already got my eyes on the Mega which I'll be ordering soon... apparently one will be needed for Project 31 (Chapter 11).

(I'll add some of these items to the Projects Spreadsheet and will note that they are loaners and not purchased...)

Thursday, February 10, 2011

Interesting Read - Why the Arduino Won

Just a short post tonight - be sure to read "The Arduino Won... and Why It's Here to Stay" and see if you agree or disagree... the article, written by Phillip Torrone, can be found here.

Wednesday, February 9, 2011

Project 13 - Piezo Knock Sensor

Project 13 uses the Piezo as a sensor... be sure to plug it into Analog pin 5 and not Digital pin 5! (Made that mistake and took me a few minutes to figure out what was wrong.)

When the program runs, the LED blinks twice to indicate the program is running... then it patiently waits for you to tap the Piezo. The video shows it in action.

Sorry for the rat's nest of wires... because I'm using a slightly different type of screw terminal, I used the jumper wires to allow me to share the GND pin. The MakerShield is still making it very easy to wire up these circuits so I'm taking advantage of it while I still can.

One question this program raised - the last bit of the code:

if (ledValue <=0) {ledValue = 0;} I'm not really understanding why this is required (although it is - see Video 2)... if ledValue drops below 0 and goes negative, the ledValue variable should simply jump to 255 when the Piezo is tapped, so it's not like the variable has to count up from a large negative value or anything. My best guess is that there must be a lower limit to the variable and when it hits it, it then "rolls over" back to 255. I may not be expressing that in the proper terminology, but... am I right? Wrong? Anyone have a better explanation for the pulsing?

BTW - A variation of this project is featured in Make magazine, Volume 25 - it's a candy dispenser that uses this technique to "listen" to a person's knock - if the knock is the proper tune, a piece of candy is released down the chute. You can watch an interview with the builder and see it in action in this video.

Tuesday, February 8, 2011

Make Live

I can't believe I forgot to post about this, but two Wednesdays ago (Jan 26) premiered the first Make:Live online broadcast. The topic of the night focused on the Arduino (and it's also the topic of the latest issue of Make - Volume 25).

The Make: Live event is supposed to occur ever other Wed, so that means a new broadcast will happen tomorrow at 9pm EDT. If you missed the first broadcast, they've collected the highlights of the event in a collection of videos that you can view here. (Scroll down and look for Episode 01 labels.)

Tomorrow's episode will focus on soldering. As I've stated in previous posts, my soldering skills could handle an upgrade... I'm hoping to see or hear something tomorrow that will give me a +1 bonus to my Soldering ability.

Hope to see you there... I'll be logged in as JamesFloydKelly.

Project 12 - Piezo Sounder Melody Player

A fun little project, but I have to say the Piezo buzzer is not my favorite choice of noisemaker. I'm not sure if the video quite captures just how grating the high pitch squeals really are...

One thing I really was glad to learn in this project was the ability to use the #define command to equate a value with a token. Similar, I guess, to a variable, but the value cannot be changed in the program (only at the #define statement). The author did a good job of explaining why this feature is useful with the dot matrix display example... makes sense if you think about it - substituting in a larger display is simple when all you have to do is change the height and width values in the #define statements.

It was also nice to be able to download the code rather than type it in - typing in all those #define statements followed by the tune and the duration information would have been tedious (probably good to do just to hammer in the idea, but I think I've got it...)

One thing I'm still not clear on, however, is the discussion of the length variable. The author divides 26 (notes) by 2 (the number of bytes in a single element) to get a value of 13. The loop will count from 0 to 13, playing the tune(x)... the way I'm reading this seems to indicate only the first 13 (of 26) notes will get played. Am I missing something?

I'm including a video below that I hope doesn't annoy anyone in the room (or office) - it's definitely Puff the Magic Dragon, but I'd never play this for my 8 month old with a Piezo!

Monday, February 7, 2011

Green Appeal

I've ordered a LOT of electronics components over the past 13 months, many of it for my previous blog that covered my work through the Make: Electronics book. One really annoying (to me) business practice I've seen time and time again is best summed up with the included picture here.

On the left is the box I got from that contained two small plastic baggies, each with a single 8x8 LED. On the right is a small box I got from that contains a total of 11 different components ordered, packed nice and tight (and with bubble wrap) and shipped in an envelope that was only slightly larger than the box.

By and far, the worst I ever received was a box larger than the one on the left from that contained a single relay. One. Relay. Smaller than a golf ball.

I'm part of the problem, of course... I try to save funds and gas by ordering online rather than driving all over Atlanta buying up pieces from various vendors. Yes, I pay more at Radio Shack, but I'm really starting to think that the amount of gas I use in my truck has to be less than the amount of fuel these big boxes take (by air and ground vehicles).

I'm glad to see that these companies want to protect my order and keep it from getting damaged, but there's got to be a better way. I really have to give a HUGE hand to for their efforts in reducing waste - I have a strong feeling this is a choice they've made and not just happenstance. And even if they are trying to save money by using less packaging, that's still a big plus in my book.

So... I guess what I'm trying to say is try and order from if you can... if this kind of thing bothers you. And please let me know if you are aware of other electronics supply companies that don't just throw a couple small resistor bags into the nearest shoebox (or larger).

Sorry for the rant... now back to the blog.

Project 11 - Piezo Sounder Alarm

Project 11 is very simple to wire up... and the program is one of the shortest we've seen so far. It uses a sine wave, again, to generate values that fluctuate, allowing the piezo buzzer to warble like an alarm.

I've got the sound from the unedited program playing in the first video. It's loud... and obnoxious. This would definitely annoy a brother or sister who entered your room without permission! I modified the variable value to start with a base of 1000 (instead of 2000) and the alarm has a lower tone... but still loud.

I'm amazed at the volume generated from this tiny device - it was the smallest one in the bins at Radio Shack. I'm sure the larger ones require more voltage, but little fella is rated for between 3 and 20 volts. I'm glad I'm not hitting it with 20 volts!

Thursday, February 3, 2011

Project 10 - Serial Controlled Mood Lamp

Project 10 opened up a lot of questions - all of them related to the code and not the actual electronics. I have to admit that I read over this project about four times, just trying to get my hands around the code. (The pseudo code at the end of the project is very helpful - read it!) But still... there are a LOT of things in this project that are not likely to be familiar to those new to programming. For instance, on page 72, the author refers to a "pointer" - I know what that is (and sort of how it works) but it may be totally new to some readers... (the author does explain it briefly, but it's BRIEF and really more confusing IMO than anything else... but chalk that up to my limited C/C+ and general programming knowledge in general...)

Let's see... what else...

I think there's also an assumption here that the reader will understand that the Serial.available command is not going to start until the Enter button is pressed and sending your RGB values but that's not expressly stated.

There's also no explanation of why the numChar is limited to 15 characters. I'm guessing that spaces are ignored, because in the example "R255, G255, B255" (including the ending NULL), if I count the spaces, I'm getting 17 characters just as the author states... but if it gets cut to 15, that means the last 2 characters get deleted, right? If not the NULL, then at least the '55' at the end of the 'B255' - I may need someone to explain this a bit better.

Page 73 - the author explains the * as designating a pointer, but he states it's been added to the variable name as '*data' - but the code in the book and the code I actually ran has the * added to the char data type - char* - any ideas why? Simply a typo?

The rest of the code, especially parsing the RGB code you type in and having it checked and then routed to the right LED - got it. Not a problem.

Overall, I like the power that Project 10 demonstrates (controlling things via a keyboard) but much of the code is still confusing to me... and I imagine it will be to a lot of readers. I certainly don't have time to dive deep into the C/C+ programming language right now, so I'll just accept that not everything makes sense right now and take what I can and move on...

Wednesday, February 2, 2011

Project 9 - LED Fire Effect

Project 9 was easy to wire up - I simply replaced the RGB LEDs from Project 8 with two yellow and one red LED. The resistor values are high enough that I don't have to worry about burning them out.

Without the diffusion provided by the white paper, the flicker is easily visible to the naked eye. I got a much better result getting the fire effect as you can hopefully see in the video. Once again, I didn't have to modify the author's code for Project 9, so no screen capture of my code here.

Also, I'm still using my MakerShield here... the mini-breadboard is just the right size for these early projects, but the upcoming projects are going to require a bit more space and a larger breadboard. Still, it's a nice little shield and definitely reduces the clutter for these smaller experiments.

I spent a few minutes digging around looking for two white LEDs (I know I have a few somewhere) but couldn't find them... so I'm not going to attempt the extra modifications for Project 9 (welding effect and rescue vehicle lights). The Welding Effect would simply require tinkering with the random flickering of the blue and white LEDs... and the Rescue Vehicle Effect would require a non-random timing of the red/blue LEDs...a trivial task at this point in time.

Monday, January 31, 2011

Project 8 - RGB Mood Lamp

Project 8 was fairly straightforward... three LEDs will have their brightness and color mixed randomly to create other colors. I wired it up on the mini-breadboard that I stuck to the MakerShield... in a few of the photos you may see the GND wire (orange) moving from place to place as I test additional solder joints to make sure the various GND posts are working.

I didn't post a screen capture of the code here - I used the author's code with no modifications required.

I didn't get quite the results that the author achieved... either my LEDs are too bright (or not bright enough in some instances) or the incremental changes are just too difficult to see. Using a white piece of paper to diffuse the colors worked occasionally, but most of the time it was difficult to see any difference.

Still, I understand the code and how it works... this would be one crazy expensive mood lamp, however, if I chose to use an Arduino and 3 LEDs to make something like this!

Sunday, January 30, 2011

Building the MakerShield

I managed to get my new MakerShield put together - my soldering skills are not the greatest, so I'm not yet sure if I managed to successfully assemble it or not, but I followed the instructions here to get all the components mounted. Here are some photos taken as I slowly put the MakerShield together.

This type of circuit board, with the holes consisting of a small metal ring embedded in the board, gave me a lot of trouble. The solder seemed to want to "pull" down into the hole and not bead up, making it hard for me to tell if the solder joint was good or bad. I used my magnifying glass to inspect all the joints, but it's a flip of a coin as to whether I got them all done properly. I'm hoping that circuit boards like this are very forgiving because... again... my soldering skills aren't so great...

Update: I stacked the MakerShield on top of my Arduino and connected up Project 7 (3 LEDs fade in and out)... at least I know I soldered up pins 9, 10, and 11 properly!

Project 6 - Modified Project #2

I just could NOT get the second modification working using the Project 5 (and sometimes Project 6) code... no matter how I modified it, I could not seem to find a way to tweak the code just a little bit to "bounce the ball." My best guess was that it would involve some sort of counter that would limit the value that CurrentLED would count up to each time (reducing it from 9... to 8... to 7...) but again... no luck with that.

So... I decided to simply hard code it to do what I wanted. I kept the array (see screenshot of my code) but got rid of much of the variables, including the CurrentLED variable, and went straight to a set of embedded FOR loops that would first loop 9 times (for nine LEDs - the ball bouncing up)... then 1... then 2... I created a variable called bounce that would simply decrement in the code every time the second loop (the ball dropping) finished. Probably not the most elegant solution, but it worked. You can download my code modification here.

I welcome my readers to share their code if they managed to perform the 2nd modification on page 58 using a different method... I'd love to see a few other programming techniques if anyone wants to share.