Bionic Arduino

Bionic Arduino is a set of four 3-hour classes in November 2007 hosted by Machine Project and taught by Tod E. Kurt. It is an introduction to microcontroller programming and interfacing with the real world using the Arduino physical computing platform. It focuses on building new physical senses and making motion with the building blocks of robotics, using Arduino as a platform.

In the class, participants are shown and experiment with the Arduino’s capabilities and learn the basics of common microcontroller interfacing, such as: digital output to control lights and LEDs, digital input to read switches and buttons, analog output to control motor position or LED brightness, and analog input to read sensor inputs.

The class assumes no previous electronics knowledge, though it does assume a little programming knowledge. No soldering is needed during the class, as all circuits are built with solderless breadboards.

Class Notes

Arduino Sketches Used in Class

Processing Sketches Used in Class

Parts Suppliers, New

  • SparkFun — Arudino board and shield, and many other neat gizmos.
  • Jameco — General electronic parts, easy-to-use, also has computer parts.
  • Digikey — Exhaustive parts supplier. Cheaper than Jameco usually, has more variation, more hard-to-find parts.

Parts Suppliers, Surplus

39 Responses to “Bionic Arduino – Introduction to Microcontrollers with Arduino”

but but …

umm… sitting in your class now.

32-channel servo controller

Hey one of the guys at the class mentioned ITC on Olympic in Korean Town as a cool place to pick up components and such. I can confirm this, and recommend it! The prices are… well it’s retail, so they aren’t fabulous, but they have a lot of good stuff. I didn’t see much in the way of ICs, but there were lots of LEDs/ Resistors/Caps/etc. a handful of kits, some tools, a decent wire section, and a big audio area that was mostly focused on the car. Worthy of a quick trip into K-Town, and a notable place to have on your list. Happy Monday!

Hey Todd,

I just found an osX implementation of php_serial.class here: http://www.geekymedia.com/phpserial.html as the original class didn’t include calls for darwin/osx.

I am running into weird problems with it, however, and have emailed the author to see if he has any suggestions (basically, it doesn’t appear to be opening a serial port, but every time I try to, I see my pin13 LED blink, so it must be doing something)

Hi Christin,
If you’re using an Arduino Diecimila, opening the serial port will reset the board on Mac OS X & Linux, so the pin13 blink is probably that. (and that’s a good thing) After opening the port, you need to wait a bit (around 1.5 seconds on Diecimila or 5 secs on older Arduinos) for the bootloader to timeout before you can send or receive stuff.

What sketch are you trying out? I’d suggest trying out something like the SerialHelloWorld and see if you can just receive characters being spit at you by the Arduino.

Hi Todd,

Great site. This has has been a tremendous help in finally understanding microcontrollers. I am an absolute newbie and now have my LEDs blinking morse code!

Question: How would you control multiple RGB LEDs with only the Arduino’s limited PWMs? Is the expandable without purchasing multiple Arduinos?

Thanks again!

Zac

Hi Zac,
Thanks, I’m glad you’ve found the class notes useful.

Controlling multiple RGB LEDs can be difficult, especially if you want to control their brightness. There are LED driver chips out there, but they can be hard to use.

I’ve been developing a solution to this problem that is called a “Smart LED”. You can read about them and the general concept of smart interface components in my Smart Interface Components talk slides.

In about a month we’ll have a type of Smart LED called “BlinkM” for sale. Each BlinkM is a smart RGB LED with 24-bit color control and an I2C serial interface, so you can control 127 BlinkMs with a single Arduino.

Hi Todbot,

Thank you, for the best class of electronic I have ever read.

Zmpulse (from France)

Hi Tod,

Thanks so much for posting all this info- it’s been a tremendous learning experience and a lot of fun.

I was able to modify the NunchuckServo code so I could access the other controller inputs- now I have multiple servos and both the buttons working- woohoo! But I do have a question about trying to smooth out the servo motion. I’ve changed the refresh rate and that definitely helped- any other suggestions?

Thanks!

Jerome

Hi Jerome,
You’ve discovered one of the hallmarks of sensors: noisy data. To smooth out the noise, the most common thing to do is to take a running average of the last N readings.
There’s an Arduino tutorial about this:
http://www.arduino.cc/en/Tutorial/Smoothing

Thanks! I’ll check into that before I go replacing the joystick with bend sensors…. :D

I really liked your lessons, only thing i want to know now is how i can use more led’s on one digital out….
your help oould be much appreciated.

greetz Job

Hi Job,

You want to be able to turn on multiple LEDs with one digital out? If you’re using red LEDs, you can put two (sometimes three) in series instead of just having one LED.

If you want to drive many more than that (or what to drive non-red LEDs), then you would use a transistor. See page page 20 of the Bionic Arduino Class3 notes for a brief description of this. The schematic would be:

You would need to adjust the number of LEDs and the resistor value depending on the color of the LED using Ohm’s Law (red LEDs are ~1.2V, green ~2.0V, and blue ~3.4V). I can help with some example scenarios if you like.

Alternatively, you can run the LEDs in parallel, by duplicating the LED+resistor sub-circuit as many times as you want, until you reach the current limit of your transistor. This has the advantage of you can keep adding LEDs without tuning resistor values and being limited by your source power. The above example uses 12V so you could stack LEDs, but the one below can just use the 5V on the Arduino board for as many LEDs as the Arduino has power for and the transistor has current capability for. The downside is you need a resistor for each LED.

I am learning the arduino…I am over loaded with info…I am looking for some one to do this with…are there any classes or seminars in the Chicago area ?

I am working towards controlling a set of motors that turn on the closer some one approaches the piece. Do you recommend the ultrasonic range finder, or the Infrared range finder ?

Much thanks
Christopher

Hi Christopher,
You should check out the Arduino Workshops forum on the Arduino site. In fact, it looks like there’s an Arduino workshop at the Chicago Dorkbot meeting on January 23rd!

Oh…I forgot

As some one approaches the piece, a motor will turn on the closer a viewer gets, so that when a viewer is 6″(or so) away, all the motors are on, but at, say 4 feet, only one is on. I am looking to learn, so any suggestions on code I can hack…

int ledPin = 13; // select the pin for the LED
int i=0; // simple counter to show we’re doing something

void setup() {
pinMode(ledPin,OUTPUT); // declare the LED’s pin as output
Serial.begin(19200); // connect to the serial port
}

void loop () {
Serial.print(i++);
Serial.println(” Thanks Again !”); // print out a thanks
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}

//Christopher//

I know some of the guys at Dorkbot. I am there, dude.
thanks

I need at least 9 pwm enabled pins for a project I am working on using LEDs. What is the best way to get this done but have all outputs independent of each other?

I looked around and have not found any solutions that did not seam like overkill.

Thanks you for your time.

Hi Todd,
Not to blatantly advertise my own product, but if you’re looking to drive 3 RGB LEDs with Arduino, perhaps the easiest solution are three BlinkMs.

If that’s not what you’re doing, then you can recreate PWM by hand using really fast loops, like how the Sevo library works.

Thanks for the headstart with Arduino! And the tips about Wiimote I2C. I’m working on a robot car. And Arduino is so much easier and cheaper than what I was originally doing (Phidgets, Gamepad Hacks, etc).

Hi, Tod.

I’ve tried the arduino-nunchuck setup as per your instructions on the Bionic Arduino, and it works fantastic!

btw, I have one newbie question on the voltage input to the nunchuck.
May I use 3.3VDC ports of Arduino Diecimila insead of 5VDC?

Thank you for your wonderful lectures

Bryan

Hi Bryan,
I think it should work fine at 3.3VDC. In fact, the Wii Remote & Nunchuck’s I2C connection is supposed to be 3.3V and just happens to work at 5V with no problem.

Hi Tod,

Thank you for your helps.

Bryan.

Hi Tod,

I just came across your site and it’s fantastic! I’m starting to look over your class notes on Bionic & Spooky Arduino.

I have a question about using the Arduino for generating sounds. One of your projects has it play mp3’s (or wmv’s), but it looks like those are played by the computer and just triggered by the Arduino.

My question is, is it possible to have several short sounds stored in the Arduino’s memory and have it play those back from the Arduino itself (no computer involved, except for programming the Arduino of course)? And to have each sound triggered by a different input. I’m thinking of using something like that for a Halloween display.

Thanks in advance.
JimGf

Hi Jim,
Playing audio is right on the edge of what’s possible with the tiny microcontroller in an Arduino. But it is *just* possible. Lady Ada, who makes lots of neat Arduino kits is working on an Arduino shield that takes an SD card and plays WAV files. Here’s a pic of her work in-progress.

Hello again, Tod.

Thanks for your quick reply with pertinent info. I’m familiar with Lady Ada’s site - I just haven’t visited it lately, but I will now.

JimGf

Hi Tod, excellent site and lessons! Helping me remember a lot of high school physics i had buried away in the memory banks! :)

I’m doing an interactive installation as a research project, and have bought myself an arduino so i can use sensor readings through max.msp to control some video/sound. I’m using Windows XP sp2 and cannot for the life of me get the arduino environment to run. I’ve noticed in various forums many ppl with the same problem. It doesn’t run.
I get the error “the system cannot find the path specified”
After various trials with the run.bat file, trying to point it to the java directory, or copying the java files from c:program files\java to arduino folder, i get the error: “Exception in thread “main” java.lang.NoClassDefFoundError: processing/app/base”

Any ideas?! I REALLY want to start playing with it!

Thanks,
G

Hi GMacArch,
I don’t use Windows much, but in my little time with it, all I did was follow the instructions here: http://www.arduino.cc/en/Guide/Windows
That is, all I did was download the Arduino-win zip file, unzip it, and double-clicked on “Arduino.exe”. I’m not sure what “run.bat” does.

The above probably isn’t too helpful. I’d recommend posting your question in the Arduino forums. Lots of eyeballs to see your problem. :)

Good luck

HA!!!! All good! working fine now! Just did all your class circuits! :)

great stuff

Hi Tod,

What a fantastic site. Thanks for sharing all this information. As an aspiring programmer of microcontrollers this is a great starting point.

I have Tom Igoes books “Physical Computing” and “Making Things Talk”. I would love to add “Bionic Arduino” to my collection. Do you have any plans of publishing such a book?

Peace

Hi Ketil,

Thanks! Tom’s “Making Things Talk” is very similar to the book I would’ve written about Arduino. In fact, if you thumb through my “Hacking Roomba” book, you’ll see that many of the projects are similiar to what Tom had, but using the Roomba as the common device being controlled.

Hiya Tod.

Love this series - it’s really helped me explore the Arduino.

I think there’s a mistake in the PiezoKnock sketch. You call Serial.Begin with a value of 19200. This led to some strange output on my system. I stuck 9600 in there, as per usual, and everything was fine.

All the best, and thanks again,

Gareth

Hi Gareth,

Thanks, I’m glad you’ve found them useful.

The speed of the serial port should not effect any of the sketches I’ve presented. You have to make sure to match the speed in the Arduino application too. Since it defaults to 9600, perhaps this is what you’re seeing.

[...] motor connected to an Arduino. The finger is controlled with a Wii Nunchuck hooked up to one of Todbot’s WiiChuck Adapters. The tilt of the accelerometer in the Nunchuck moves the middle finger on the [...]

Hello. I downloaded your sketch for the nunchuck. But I get only values between 0 and 250 for x,y,z acceleration. Is this okay? I heard that one get values between 0 to 1000. How do I know if I accelerate the nunchuck to the left or to the right? I have not altered your code NunchuckPrint. I’d appreciate any help. Please. Sincerely, Alexander

Hi Alexander,
You are correct. The output of the nunchuck can be 10-bit (0-1023) but for most purposes an 8-bit number (0-255) is easier to deal with. You can see the code to get the 10-bit number here: http://www.windmeadow.com/node/42

To determine left/right tilt, look at the numbers from nunchuckprint and see how they move. You’ll see that one number has middle value that shifts from a min to a max, that’s the tilting from one direction to the other.

Thank you for your quick reply. :-) I tried to fetch an min and max value, but the values I got where in the same range whether I accelerated the nunchuk to the left or to the right. I read on some site that the idle value is 500, 300 is a sure left, 700 is a sure right…

Something to say?