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...