All posts by Kevin Osborn

About Kevin Osborn

I’m a Maker and ardent amateur educator. I also love to create art, hack electronics and do geeky activities with my kids.

TI MSP430 LaunchPad First Impressions

The DangerousPrototypes Blog had a quick post on a deal that Texas Instruments was offering a Watch/development kit for their low power processors for only $24. I’ll be telling you more about this in a future installment, but while I was grabbing the deal, I saw this neat little development kit for their low-power value-line processors. It cost all of $4.30, includes two processors and all the tools you need to get going.

First, while this is an extremely cheap USB enabled development board, this is NOT an Arduino. It is however, an excellent way to introduce yourself to real “on the metal” microcontroller programming.

I downloaded all the tools, and visited their site for pointers to example code, etc.

First, TI is really trying to do the community thing, with a wiki, and featuring other people’s content.

They also have a curated portal that has links to some really cool projects too at :

http://e2e.ti.com/group/msp430launchpad/w/default.aspx

They also have a really good, structured workshop with videos and labs to really give you an overview of the platform. So far, I’m about a third of the way through the workshop, and I’m really impressed so far.

Installing Code Composer studio took a long time. It needs work on it’s installer code, as it gave all sorts of scary warnings about User Account Control in Windows 7, but in the end it worked out fine.

This eclipse based tool is TI’s flagship micro development platform and is usually licensed for a $500 or more. This
free version limits you to 16 K of code, but that’s about the biggest device in the MSP430 value line.

It’s also really nice having hardware debugging support. No more Serial printlns! Set breakpoints and examine variables. Awesome!

These processors feature super low power features. In fact the other thing I bought, the chronos watch development platform uses the same line of processors. I won’t go into all the modes here (covered very well in the workshop) but these processors know how to sip power! We’re talking microwatts or less.

The MSP430 processors feature an extremely flexible clock architecture. This allows you to do all sorts of clever things, using different clocks for different parts of the chip, or even driving external circuitry. I’m just starting to wrap my head around all this, but it’s one of the cool things my fpga friends brag about, and now I can play too!

The Von Neuman memory map (single address space for everything) is much easier to use than the atmel’s harvard architecture. No more PROGMEM weirdness. Of course you still have to be ginger about writing to flash memory (constrained to write in blocks in self programming mode the same as AVR’s).

It has pretty advanced analog to digital conversion  with DMA, so you can set it up to transfer directly to memory. Not all the chips have this but many do, and some have fancy compariters to use for pid control, etc.

All in all, I’m very impressed. I think it will be a lot of fun, and a good learning tool. It really isn’t as easy as the Arduino, so I wouldn’t recommend it for “Toe dippers” or folks looking for a quick and easy automation tool.

If they keep offering it at this price though, it could be a great teaching tool. The processors (2!) it comes with are pretty small (both in IO and memory, 2K) so it will be hard to squeeze a lot of Arduino like library in there, but for some small teaching type challenges, it may be good enough, and you can always upgrade the processor for under $3.

A week later, I also ordered the CapSense booster pack, a shield to demo the chip’s built in (no additional hardware needed) ability to handle Capacitive  touch controls. I’ll probably post more about this once I’ve had the chance to play with it.

Scary Robot Pumpkin Invasion

I left work a little early (around 4pm) to finish up the Cylon pumpkin.  The carving went pretty well, but it was starting to get dark by the time I put the electronics in.

If you want to do this project, please don’t do as I did with scratch building, and just buy the kit. When I put the electronics in the pumpkin, they didn’t work. I pushed my fingers around on the back of the board and I could get it to work sometime.

Back upstairs, I x-acto’ed between traces where there was already corrosion (I didn’t clean the flux very well) and resoldered a few things. Whew! Got it working 1 minute before the first trick or treater came!

[youtube]http://www.youtube.com/watch?v=QrUGX8nCOvk[/youtube]

And here’s the whole display. I hope you enjoyed it!

Desperate Halloween Project: The Cylon Pumpkin aka Larson Scanner

We’ve been so busy this season, there’s been little time for extra things. I used to go all out for Halloween, but this year we decided we couldn’t do much more than help the kids with their costumes. Well, this bothered me, and I decided to at least try to do a cool jack-o-lantern.

I’ve mentioned my love affair with EvilMadScientist.com before. They have a ton of quirky, always fun projects. (I’m still trying to convince Joyce we need an eggbot!)

They have a very nice, inexpensive kit to do a “Larson Scanner” which is  a row of LED’s that scan back in forth, like in the Glenn Larson TV shows Knight Rider, and Battlestar Galactica. They also love Halloween, and published a list of their Halloween related projects. The first Cylon Pumpkin they did, was a simple slit in the pumpkin to show off the scanner, but more recently they did this awesome carving:

The project linked to this picture uses an older circuit, not the EMSL kit...

Now I haven’t carved mine yet, and I wasn’t thinking ahead. It would have been much easier to just order their kit ($13) but I had most of the parts lying around, and I stayed up late laying it out and soldering it (badly) to a proto-board. My local electronics store doesn’t have a very good selection of proto-boards, but they had a cheap (<$3) proto-board laid out like a solderless breadboard.

I’m sure this is old hat to most folks, but I realized that I could squeeze the IC in, not in the middle where it’s supposed to go, but toward one side by cutting the traces between the rows of pins for the socket.

I didn’t want wires on the front, so I tacked them from the back, and that was hard, and a little messy, as it’s very cramped especially in the middle of the attiny micro.

Once again, this whole project wouldn’t have been possible without my adafruit usbtiny ISP programmer. I used an Evil Mad Scientist minimal target board to program the chip.

EMSL’s code is a thing of beauty and a lot can be learned by studying it. Hopefully I’ll be back after tomorrow night with pictures of the finished Cylon-O-Lantern.

Soul-B-Gone: A super camera remote

I’ve had a lot of fun with my TV-B-Gone, which I bought direct from Mitch Altman (the inventor) at Maker-Faire RI a couple of years ago. I particularly like turning off the plague of flatscreens at work, and every one I can see through the glass doors in my building!

I have a Nikon D90, and the little IR remote which has been very useful, but is pretty weak. It’s flakey past 5 feet, and you really have to point it right at the front of the camera. I thought, gosh, the TV-B-Gone is AWESOME, and open source, so I set about to make it into a super Nikon remote.

Here’s the 1.2 kit from Adafruit. It’s more powerful because it uses a better design of cascading transistors.

The actual hack took less than a half hour. I found someone else had done the reverse engineering of the timing on the web (http://www.alanmacek.com/nikon/)

The 1.1 software was super easy to translate the timings to. I recently bought a version 1.2 kit (the current version) and ported the software which involved mostly changing the polarity of on/off, and using a single pin instead of two.

The biggest part of this project was assembling all the bits to program. I built a usbtiny (Love it…) and used an extra TV-B-Gone pcb as a minimal target board.

The thing is Awesome! I haven’t tested how far it goes, but it hasn’t failed me yet, and it bounces around any room I’ve tried it in to be far less directional.

Thank you Mitch and Limor! Your code was great, and it was such a thrill to make something I wanted!

You can download the firmware from github. Now the only problem is switching the chips. The 1.2 version frees up a pin to use as region select, so it is possible to use it as a switch to select between camera remote and tv-b-gone.

What Can You Learn From A Kit?

The family and I recently drove down to Providence, RI for the Mini-Maker Faire and Waterfire. It was really mini this year, but there were some good groups there including several hacker spaces and several of my favorite micro-businesses (mostly small electronic kit makers.) I’m usually inspired by something, but often too cheap to buy the really cool stuff. I bought two LED array kits from two different vendors, thinking it would be a good learning experience, both for myself and the kids. It’s also great to support local Makers! Also, I figure I’m contributing to open source by giving them feedback. John has already responded to the feedback I’ve given him and will be updating the site, and maybe even future designs (I thought he needed bigger solder pads…)

I bought two kits: a Charlieplexed 10×10 LED array from John Luciani (http://wiblocks.com) and an 8×8 LED driver based display from Modern Device. A charlieplexed display takes advantage of a quirk of microcontroller IO lines to control many LED’s with a smaller number of control lines. In the 10×10 display example, 11 IO lines are used. Since you only use the microcontroller and no additional chips, this design is much cheaper than the alternative. The disadvantage is that because it is multiplexed, the display will be dimmer and can’t really achieve full LED brightness when all the LEDs are lit.  The driver version uses special LED driver chips that communicate with a serial protocol to use only 3 or 4 lines to drive many LED’s. In the Modern Device unit, it uses 4 chips (which share the same serial “bus”) each controlling 16 LEDs. Not only does this allow full brightness, the boards can be daisy chained together to make bigger displays, using the same control lines and a single microcontroller driving them.

I haven’t built the Modern Devices display yet, but I’ll share what I learned from the Wiblocks kit.

Picture from John's site. Much nicer assembly than mine.

1. John is a really nice guy!

Ok, I already knew this as I’ve met him before at various maker events, but he was really generous as well, giving me a spare PCB for one of his drawdio remix boards (I have all sorts of EVIL plans for these! Stay tuned). He accidentally gave me the wrong board (an 8×8 board), so he promptly mailed me the right one and let me keep the other.

2. Read the instructions.

Ugh, could have avoided this!

I admit I’m one of those guys who thinks winging it is better. One really cool thing about John’s designs is that he wants you to use them as a starting point, and makes them very flexible.  The microcontroller board he includes with the kit is a mini version of the Arduino he calls the PICO1TR. He include instructions (and the appropriate components to build it to be compatible with 3.3V logic, or 5V logic.
Since most of my past experiments have interfaced with 5V electronics, I built the controller as 5V, and then started the LED board and found out that with 3.3V you don’t need ballast resistors (not included.) Well, not a big deal, except my stock of resistors is all 1/4 watt, and the board is quite compact and laid out for 1/8 watt resistors. This meant they stick up, and I had to add some ugly insulating material to make sure I didn’t short things out.

3. Debugging!

There were a lot of LEDs to solder, and it’s really hard to keep them all neat and straight. Fortunately I learned that flux is my friend and the soldering went very quickly, and looks pretty neat. Some of the LEDs point this way and that, but I was in a hurry. The proper way to do this is to drill holes in a piece of wood or plastic, stick the LEDs in there, and turn the board upside down and solder in place. Like I said, I was in a hurry….

I installed John’s libraries and tried to download his sample code but it wouldn’t compile. It turns out that in one of the Arduino releases since John built his library, they included an new WinAVR which has different pin names. I changed all the PB0 etc. to PORTB0 etc. I then downloaded the program to the board, and Viola it worked! Well, mostly. There was an extra LED coming on sometimes in the blank area and when that LED was supposed to be lit, it didn’t and several other LEDs lit dimly. I wrote some test code:

Turns out, the LED was in backwards, and because of the way the charlieplexed LEDs are hooked up, some current leaks into the rows and columns around it. (I haven’t completely thought this through, so that may not be entirely technically correct…) I reversed the LED and everything is cool!.

[youtube]http://youtu.be/Mp_v50feMz0[/youtube]

4. Let’s write some code!

One of the excuses I used to buy this, was that I thought it would be good to teach about arrays. Now I haven’t been brave enough to try it on a kid, I did write a bunch of bitmap manipulation routines to set and query x,y values in the array. Hmmm, what do do with that? Conway’s Life of course! I’d never written that before, but it was fun, and made me think a little! Right now I have it set to randomly re-seed after a certain number of generations, but I’ve laid the groundwork to detect static displays, and the next version will run until the current generation is just like two generations back. Another thing I wanted to learn, but is in the future, is to post code on github, and I have an account there, but haven’t gotten around to posting it yet. Until then, here is my modified library, and here is my life code. Drop the library folder in the arduino/libraries folder, and the life code is an arduino pde file (add the folder to sketchbook folder).

[youtube]http://youtu.be/W44LtPPEcp8[/youtube]

Getting 64 bit flash to work in Google Chrome on Linux

I was having trouble with the chromium browser working with gmail.
A friend was having no problems, but he was using chrome direct from google. I installed that, but it said the flashplayer was out of date.
The upgrade isn’t automatic, and I struggled a bit to get it going. I’m sharing this to save folks some time.

Maybe it’s documented easily somewhere, but it wasn’t obvious to me, and after trying several googled answers, this is what worked for me:

  1. Download the 64 bit (experimental) plugin from adobe labs
    http://labs.adobe.com/technologies/flashplayer10/square/
  2. Extract libflashplayer.so from the tgz archive
  3. sudo mv libflashplayer.so /usr/lib/mozilla/plugins

Restart chrome and it should be picked up. Test with youtube, and enter about:plugins in the location bar and it should show up there. It wasn’t obvious to me that chrome would be looking in a mozilla directory, but there you go!

I don’t know if it’s necessary, but I also removed (renamed actually)
/var/lib/flashplugin-installer/npwrapper.libflashplayer.so
(which I found by putting about:plugins in the location bar of chrome.)

USB midi controller (Theremin style) on Arduino Uno

Creating Midi controllers with arduinos

Uno+shield

A warning to my non-technical friends: The following post is long and technically detailed. You might want to just check out the pictures and move on, but i’m hoping I can save a few people some hours of work by detailing everything I went through.

My son was interested in using a midi controller that used the distance your hand was above it to control his DJ rig with Ableton Live on his mac. I had done previous arduino midi projects with a midi shield from Sparkfun, but his mac doesn’t really have a native Midi interface. I found out that the midi standard now specifies a way of transporting midi over USB, and in fact most of the modern keyboard controllers, etc have this built in. Unfortunately. until recently, the USB interface of arduinos was a simple usb to serial controller chip that requires a driver, etc. People have written software drivers that convert between these (described here), but I felt that this was too complicated. There’s a commercial arduino-like clone that supports midi very easily (the Teensy) that I’ll talk about in a later post, because in fact, it’s actually a lot easier to use than what I ended up doing.
Arduino UNO to the rescue!

Instead of the USB-serial chip of previous arduinos, the UNO actually has a second microprocessor which is one of the USB enabled ATMEGAs, the ATMEGA 8U2. There’s even a bootloader in it that allows you to use Atmel’s DFU/flip protocol to load code.

Unfortunately, when I started, it was very difficult to figure out how to get this going, so I ended up trying to program the chip directly.

Making LUFA applications for the ATMEGA 8U2

A very cool guy who is very into ATMEL micro’s has written a wonderful library for just about every class compliant USB device to run on the ATMEGA processors. Dean Camera’s LUFA (Lightweight USB Framework for AVRs) can be found at Dean’s website; http://www.fourwalledcubicle.com/LUFA.php

One thing that wasn’t obvious to me in building LUFA applications is that the individual projects drive the build process. In other words if you do a top level build, and then drop down to your new project directory, you’ll get errors. So if you have already built LUFA, do a make clean at the top level, then cd to your project directory and do the make from there.

There are several good examples to start from and I wanted to make sure I could restore the UNO’s firmware, so first I built arduino-usbserial. This can be retrieved from the arduino repository or in the hardware/firmware directory of the arduino distribution.

The version distributed with Arduino-0022 seems to be incompatible with the latest version of LUFA(101122) but compiles nicely with LUFA 100807. Note that the following assumes you’ve already installed winavr (or the your platform’s equivalent)

  1. Download Lufa from http://www.fourwalledcubicle.com/LUFA.php
    Specifically I used:
    http://lufa-lib.googlecode.com/files/LUFA-100807.zip
  2. Copy arduino-usbserial from arduino-xxxxx\hardware/arduino\firmwares\ to the project directory of LUFA. In my case this is c:\LUFA 100807\projects
  3. cd to the arduino-usbserial directory you just made in LUFA and type make. Note I edited the makefile to use usbtinyisp for programming.

Getting the code on the ATMEGA8U2

There are two choices for loading the code onto the 8U2:

  1. Using the pre-programmed DFU bootloader. The instructions are now a little clearer, but still hard to find. Here’s the link.
  2. Soldering in the ISP header and using an ISP programmer such as Adafruit’s usbtinyisp I dried this first, and somehow bricked the usb part of the UNO. I can still upload code to either processor using USB tinyisp, but no USB goodness. I bought a smd version of the UNO which had the programming header in place and I was off to the races.

Moco lufa!

I was starting to look into the midi example in LUFA, but after several exchanged on the adafruit forums,  user morecat_labpointed to his project which is a very nicely done firmware for avr usb micros to do a serial to usb-midi conversion.

The MocoLUFA firmware (Thanks Yoshi!! (morecat_lab) works terrific, unmodified on my new SMD uno (which took forever to get here, by the way, grumble grumble)

First you need to download Moco for LUFA from Yoshi’s site: http://web.mac.com/kuwatay/morecat_lab./MocoLUFA.html

Since the existing Midi library uses the 328 serial port and the MOCA firmware relays those (repackaging them as USB messages), The midi code is trivial to implement. The only fiddly bit is that once you’ve reprogrammed the 8U2, you need to either restore it to load the 328 code, or use an isp programmer (which I recommend)

I still can’t get the hang of the DFU bootloading stuff (and the jumper pads seem to not be there for the SMD version), but fortunately the SMD UNO comes with the ATMEGA8U2 ISP programming header.

One detail that’s important: If you want to recompile the usb-serial firmware, you need an older version of LUFA, while the MOCO stuff compiles under the latest version. (Dean Camera apparently reorganized a lot of the headers which makes the application code incompatible without modification)
Here’s the version you need for MOCO:http://lufa-lib.googlecode.com/files/LUFA-101122.zip
To restore the original bootloader, you can either save out the contents of flash and restore it, or use one of the hex files in the arduino[xxx]/hardware/arduino/firmwares directory.

The MOCA interface loads automatically in Windows 7 (takes a while, but does configure) and instantly in MAC OSX

Theremin-like…

Well, a real theremin uses antennas and radio waves to modulate sound based on your hand position. I used distance sensors commonly used in hobby robotics. I made two version, one with the ultrasonic MAXBOTICS LV-EZ-1 which you can buy from Adafruit, Sparkfun, etc., and a Sharp IR sensor available from the same places. The Sharp IR version went into a box with a Teensy (which was kindof broken) so I’ll write about that later when I get the parts to finish it.

The Midi Bits.

The Maxbotics part is pretty easy to use. It has a proportional analog voltage output, RS232, and PWM. I hooked the analog output to one of the arduino analog inputs. The output is a bit noisy, and jumps around a little, so I resorted to a running average to smooth it out. This means I take several samples (configurable) average the last x number and report the mean of those samples.

Grant wanted midi CC (control change messages) to map to different music parameters (looping etc.) so I wired that in, however I didn’t have anything as fancy as his software, so for testing, I had it output note-on and note-off messages. I used a freeware program for windows called midi-ox

All Buddha’s Throughout Space and Time

Buddhas
Illustration by Kevin Osborn based on an original image by ebay seller 2411florence

I’ve been looking for a fun art project for a while. I came up with an idea that is probably silly, but I think it might just be fun.
I’ve ordered a latex Buddha mold and am planning on making 108 Buddhas. The original vision that prompted this was a large number of Buddhas stretching out to infinity. Also, I was thinking of my 365 self portrait project where I was doing something everyday. Everyday is a bit stressful at the current time, but I do like the idea of working fairly consistently but with variety. A couple of thoughts were to make an ice Buddha (for impermanence), different materials (plaster, resin, dirt) and trying to tie them in to various dharma concepts. I think it will probably take about a week per Buddha, and there will probably be a few failures that won’t make it into the set. I can think of about 5-10 variations right now, but that’s far short of 108, so it should be interesting and very challenging. I also think it would be fun to invite others to do Buddha images, paintings, sculptures and whatever, and share them on a flickr group.
I have a few more details in mind that I’ll share later, but wanted to know what people think?

Micro-readerboard fun!

There are lots of creative folks out there, and one of my favorite sites is Evil Mad Scientist

Windell and Lenore are always doing something interesting, everything from cooking to electronics. They also sell kits and supplies for their projects at http://evilmadscience.com.

Long ago, I was impressed by their LED menorah, where they soldered the led’s directly to the pins of a little micro-controller. Later they came up with another holiday decoration which was a 18 segment alphanumeric display soldered directly to display messages one character at a time. I decided I wanted to do this, both as a project for the kids, and to make some specific message gifts for some friends and teachers of mine.

mrb-complete
Here’s my finished product.

Makershed has a kit, but since I wanted to do my own messages anyway, the preprogrammed micro had no value. I did find it convenient to buy the displays and battery holders from EMSL. I got the ATTINY 2313’s from Digikey.

Here’s the main page describing the project, and here are the technical details.

I found the technical page useful for debugging my soldering when some of the segments didn’t light up as planned.

In order to change the messages you’ll also need a way of programming the ATTINY’s and I have a USB TinyISP from Adafruit.

You can also wire up an arduino as an ISP programmer, but I find the adafruit programmer to be cheap and very useful.

I also bought a mini-target board from http://evilmadscience.com/tinykitlist/112-tiny2313 including a new 4313 (twice the memory) and a ZIF socket that makes it really easy to remove the chip.

tools

Here is the target board hooked up to the USBTinyISP

I would highly recommend buying enough parts for at least two Microreaderboards so you can make one with a socket. I did this (in fact I took advantage that EMSL gives you a price break for 5 displays), and even though I was sure I checked it, I noticed misspellings in one that I had already soldered to the display!

I found it difficult to solder a regular socket to the display (the pins are too short) but I had a wirewrap socket from the old days hanging around, and though it sticks out, it is great, with machined holes that make it easy to insert and remove the microprocessor.

mrb-socket
QA version!

Windell’s code is terrificly self documenting, and easy to modify. One thing I didn’t like though, was the fact that there was a RAM buffer used to hold the string being displayed. This means that you have to make sure your strings aren’t longer than 75 characters. You also have to count your strings. I did a minor hack that allowed all that to be calculated at compile time and to read the characters directly from flash memory. You can find my modified code here.

It’s fascinating just trying to read the words one character at a time. If you lose focus for an instant, you lose the word! What a great mindfulness practice. I did another minor hack supplementing the font with a few other characters to allow a spinning clock. You can find the code mods in a forum posting at EMSL’s forums here.

I’m really enjoying thinking about what I want to say in these, almost as much as making them. I also bought a larger display to make a giant one, and I’m thinking about running one off a coin cell to make a microreaderboard throwie.