Tuesday, January 22, 2008

Arduino Diecimila Reset Discussion

Note the Atmel's Reset pin characteristics

Also, note the brown out specs,

Monday, January 21, 2008

Arduino Motor Driving Discussion

Some people are having issues with resets when driving DC motors from their Arduinos. It has been suggested that previous Arduinos (without auto reset) are less sensitive to noise than the current ones. Lets not talk about the difference in Arduino makes for right now. Instead lets concentrate on whats happening with the motor setup and why this could cause problems. Finally, we'll suggest a proposal to reduce the noise in the circuit.

First, the different components involved are
1.) DC motor
2.) Output drive circuitry
3.) Arduino (of course)

Motor:
In it's most simple form (forgetting back EMF) the motor would look like this circuit:




The Arduino would be driving this motor with an external transistor configuration shown below using a fixed frequency and variable PWM (pulse width modulation) to control motor speed,




Now, lets put them together and we have our basic motor drive circuit,




Now lets look at how the current flows when the transistor is on,



Notice the clamping diode installed around the motor. This will help clamp any energy coming from the coil in the reverse direction when the transistor switches off.



Now that we understand the basic setup. Lets see if we can shed some light as to why resets are happening.


Lets start off with making sure we still have a clean 5v supply running the Arduino when we're running the motor...

DC motors can suck a lot of juice from the 500mA limited USB supply. Lets look at the high side of the motor's supply to make sure we're doing anything nasty to the poor USB.



The below image shows how a capacitor is used to bucket the energy.


So maybe, we should limit the capacitor's ability to draw too much current from the supply by adding a series resistor. Using a passive component like a resistor has some efficiency implications. There are much better ways to limit current through the use of active components.

For our purposes of trying to clean up the 5v supply, we can entertain the idea. See the image below.
Say for instance, the bucket capacitor is 10uF. On power up, it will take 25ohms * 10uF = 250 microseconds to charge up to 62% or 1 time constant. After that, the voltage ripple on your 5V supply should be much less than before because the current is safely limited to motor.



Wednesday, January 16, 2008

Bug Labs Packaging

Bug Labs is finally releasing pictures of their upcoming Bug modules on their website. Now more than ever we're able to see what they've spent their time working on.

These days, it takes a lot for mass produced electronics to get noticed. Usually when I look at something electronic these days, I tend to notice the outer packaging. Shopping for cell phones, mp3 players, etc. I usually go with the one that looks best.

Playing with electronics hardware has kept me busy and awake all hours of the night because there's something inherently self-satisfying about using electronics to create something. Wiring, connecting, and sometimes soldering to create projects has enabled me to learn a lot about electronics.

From the pictures, they've spent lots of time making the packaging of the modules, but it seems like they've missed the idea. How do premade and pre-packaged device allow people to make electronics creations?

Since I like to tinker, what if I don't like their screen or camera module? What do i do if it can't fit into my application? I'm just not sure I'll have enough ability to customize the modules to my liking. Where is the hardware tinkering? Everything is already done for you.

They have done a decent job at selecting some of the modules that people might like to play with, but I hope they leave something for me to do with them!

Tuesday, January 15, 2008

GPS for Arduino in less than 30 minutes!

I just grabbed a Libelium GPS shield for my Arduino, and wanted to make it work. With minimal effort (about 20 minutes), I was able to get a fully functional GPS system working - incredible. Pardon my enthusiasm, but rapid design and prototyping like this was never possible when I was in school. We were too busy making LED's blink back and forth ala nightrider - and for the adventurous - debounced button inputs ala simon. Fastforward to 2007, and you can have a fully functioning GPS-enabled accelerometer hiking / backpacking logging device in less than an hour of mixing parts together.

Without further ado, here's a picture of the GPS shield sitting on my Arduino:



I'd go into further detail about the circuit or the schematic, but there's really nothing to talk about. You just pull the board out of its wrapper, snap on the antenna, plug in +5V (red wire) to the pin tower labels "+5" and ground (black) to the pin tower labeled "GND". Set the board starting at the Arduino's pin number 8, and you're set to go.

As usual, I've posted the source code for the project over at liquidware - enjoy!

Prototyping board

This past weekend, I bought another prototyping shield from Ladyada here in NYC - but this time in an unassembled kit form. The funny thing is that it would have been much quicker to just drive down to Adafruit's headquarters downtown (from midtown) to pick it up. But the package showed up two days later, which isn't bad for NYC mail.

Here's a picture of the contents of the kit, poured out onto my desk (which is actually a small piece of cloth-covered corkboard from my old office):




I then clamped the PCB onto the "3rd hands" and began soldering away:





After only 15 minutes with the gun, and only 1 redo, I sat back and appreciated my work of art:





But it got me thinking... why not make an extender board, that allows someone to attach two modules onto the Arduino base? That way, you could put two breadboards on one Arduino, or possibly a breadboard and a GPS kit?

The possibilities would be endless... and I shall call it the "Pin Replicator Shield". I've started a project entry over at liquidware to hold my thoughts and progress on the new shield.

Saturday, January 12, 2008

Review of Bug Labs' launch

It looks like the folks over at Bug Labs have finally announced pricing, and it has been received with a giant thud. For the unfamiliar, Bug Labs is a startup based out of NY with a vision for making modular consumer electronics devices. On paper, this idea sounds great. If you look at most consumer products on the market today, most tend to consist of 4 main components:
  1. A screen
  2. An input device (buttons, switches)
  3. A power supply
  4. A functional component (GPS, MP3 decoder, Wifi, Cell phone, etc.)
If you can standardize the first 3 components, the 4th is effectively the primary differentiator of a consumer electronics device, and why not make it modular enough to plug-and-play and upgrade over time? The vision for consumers may be a modular device that they can build from components as they desire.

Sunday, January 6, 2008

Arduino Hardware Playground

Just the other day I picked up my first Arduino.

The first thing I did was rush over to the Arduino website and start browsing around. In search of ways to play with it, it didn't take me long to stumble on this section,

http://www.arduino.cc/playground/Main/InterfacingWithHardware

Wow! I could not believe how many hardware devices there are here. Tons of contribution to this area has really expanded the capability of my $30 Arduino. Definitively well spent cash.

It's so unbelievably easy to use one of these things. Take for example, you want to print out a number to PC via the serial port, you don't even need to do any processing at all on the bytes to get it into ASCII form -it's all done for you.

void setup()
{
Serial.begin(9600);
}

unsigned char num;

void loop()
{
Serial.print(num++)
}


This may seem silly to write about, but I'm used to writing tons of support code to make this soft of thing work. It really is plug-in and "play"!

Tuesday, December 25, 2007

Arduino with Radio Shack Parallax accelerometer

I think the theme for today will be rapid prototyping and speed. In between Christmas celebrations, and holiday movie re-runs, I've run back to my room to whip together some circuits. It's insane how easy it is to build functioning devices with the Arduino! Case in point: ~30 minutes tops to build a fully-functioning hand-held accelerometer driven device.

I started with the Parallax accelerometer, which I picked up from Radio Shack. The full name is "Memsic 2125 Dual-Axis Accelerometer".




Using the two diagrams above as the theory, and borrowing code from the Arduino community (special thanks to Marcos Yarza for the initial code, which I've cleaned up below). The first step was the wire up the chip to the board. That was easy, since the kit comes with a pinout sheet: two pins are tied to ground, one to +5V, Tout is ignored for now, which leaves Yout and Xout. Xout and Yout are PWM outputs that, according to the second schematic above, output a variable width pulse based on their reading. I wired it up, and then read the values out to the serial port:



Once I had ranges for the values, I got a little creative and threw in some condition "if" statements, tied to LEDs on the prototyping board. Now, an LED should illuminate whenever the board is tilted in that direction:



Here is the source code I pulled together. I moved around some of the original code, to make it more cut-and-paste-y into your own projects.

Arduino with Radio Shack Parallax motion sensor

Well, that didn't take long. It's been less than a week, and I'm already feeling quite familiar with the Arduino platform. I just mashed this circuit together in less than 5 minutes (in fact it took longer to video tape than it did to make)!

I picked up the new Parallax motion sensor circuit yesterday for $10 from Radio Shack. Parallax has done a great job of making these chips accessible and easy to use by making the documentation available online. I would recommend all parts vendors to be this accessible, in fact, since it makes circuitry approachable to the novice, and reduces headaches for experts too:







Here's a video of the motion sensor "in action" (pardon the pun):



The device only has 3 pins: one that connects to ground, one that connects to +5V, and a signl pin that I've connected to Arduino pin 8. Then, I've connected an LED to Arduino pin 5, which I turn on for a second whenever the motion sensor is triggered. Here's the source code.

Arduino with Parallax Sonar sensor

Yesterday, I picked up one of the heavily-advertised Parallax PING Ultrasonic sonar sensors from Radio Shack, and wanted to see how easy (or difficult) it would be to get operating with the Arduino. As it turned out, it was incredibly easy - in fact, it took less than 15 minutes of coding to get operating, and all I needed was the PDF spec-sheet from Parallax:


I plugged the sonar module into the top of the breadboard, wired ground, wired +5V, and then connected a wire from the signal port to the Arduino's pin 8. 15 minutes later, here's a video of me moving the sensor towards and away from my laptop's monitor:



After I wrote my own code, I found a slightly more elegant way to wait and count the length of the return pulse - there's Open Source community in action - thanks!

Anyway, here's my code - I've uploaded it to Liquidware.

Monday, December 24, 2007

Video: Blinking an LED

I walked through the blink-the-LED tutorial from LadyAda, and recorded the steps I took to upload, and tweak the program slightly. As I mentioned in my previous post, this reveals a lot about the usability and "approachability" of the Arduino platform. The PC program is easy to use, and changes are almost immediately visible on the USB-connected Arduino, effectively decreasing coding-demo-operation cycles to a few seconds. In my PIC days, I was used to coding-compiling-burning to chip on a programmer-inserting chip into circuit-connecting power-operation, which took at least 5 minutes per iteration. You can see for yourself below:

Here's a video of the blink program:


And this video illustrates slight tweaking of the program, and how quickly the changes can be seen on the board:

Going through the motions

I figured I'd start off slow by following a decent set of tutorials on the Arduino. Independent of experience, it's always been helpful to me to get a decent idea of "platform workflow", or how engineers and designers approach development on a platform by walking through a few examples. For instance, I've noticed that PIC, BASIC Stamp, Motorolla, and ARM hackers tend to approach the design process differently: Stamp guys tend to prototype on the fly, and write code while they run, PIC guys tend to draw schematics before building, and Motorolla /ARM (and other low-complexity sub-PowerPC/x86) tend to go through more elaborate pre-design, pseudo code, meta/block diagram, and schematic drawing before finally building and coding.

For purposes of the Arduino, I've chosen to start here:

LadyAda Arduino Tutorials

I found the link on the Arduino main tutorial page