Maker Workshop - Personal Flight Recorder on Make: television

John Park hacks a Wii controller and turns it into a personal flight recorder that can sense and measure the stomach-churning G forces of roller coasters and other high-speed, high-risk activities.

Download the PDF for this project.

Download the Personal Flight Recorder program for the Arduino.

Get the m4v, subscribe in iTunes, watch on YouTube or Blip.


Recent Entries

Comments

Oldest comments listed first.

Posted by: RB on February 28, 2009 at 8:50 AM

I thought I read somewhere, a long time ago, that amusement parks frowned on g-force measuring equipment because they felt the measurements were "secret"...


Posted by: Glen on October 3, 2009 at 12:26 PM

ok so now we need a way to capture this data then a Make project that covers bulign a "chair on hydraulics" that mimics the movements from the captured data

Combine that with the camera footage you recorded and hey presto Coaster-Sim !

:-)


Posted by: John Park on October 3, 2009 at 3:37 PM

Glen, awesome! We actually did make a second version that captures the data to a SD card, along with GPS data. You build the chair, I'll send you the data. Deal?!


Posted by: dale on January 4, 2010 at 8:24 AM

Is there somewhere I we can find the code for the version that records the data to an SD card? Thanks!


Posted by: Anonymous on February 28, 2009 at 9:34 AM


Is this the episode that JEP's ears and eyelids start flapping because of the shear speed of the ride?
----I love this episode!...


Posted by: John Park on March 1, 2009 at 9:41 AM

RB, that wouldn't surprise me, but they can't frown at that which they cannot see, right? :) If wear it around your waist and tie a sweatshirt around it you ought to be fine. Not that I'm endorsing this should they decide to haul you off to the amusement park prison...


Posted by: DanThompson on March 1, 2009 at 5:19 PM

Awesome stuff John! (and everyone else involved) I can't get enough of this show. I wish it was on free to air TV in Australia. Or even cable for that matter! This show just keeps getting better and better! Well done.


Posted by: Anonymous on March 25, 2009 at 7:48 AM

In the video it says that the lcd has three wires. Most have many pins. The Vss pin goes to ground (black wire) the Vdd pin goes to the +5V (red wire). Where does the Yellow Wore go?


Posted by: John Park on March 25, 2009 at 8:31 AM

Serial LCD

That's an excellent question -- you're right, most common 16x2 LCD screens (like this $14 one: http://www.sparkfun.com/commerce/product_info.php?products_id=255) are parallel and have seventeen thousand wires coming off of them (or ~11 to 14). The most esteemed Ladyada Limor Fried has a nice tutorial on hooking one up here: http://www.ladyada.net/learn/arduino/lcd.html

I didn't want to eat up that many pins on the Arduino because I wasn't sure how many would be needed for everything else when I started, so I took the easy route and ordered a serial LCD that sends all the data over a single wire for $25: http://www.sparkfun.com/commerce/product_info.php?products_id=461

This was plugged into pin 7 on our project, but any digital pin would work depending on your sketch.

I look for these types of shortcuts a lot these days because my time is so limited. If I can cheat a little and make things go quicker for an $11 premium I'm all for it!


Posted by: John Park on March 25, 2009 at 8:52 AM

Serial LCD

That's an excellent question -- you're right, most common 16x2 LCD screens (like this $14 one: http://www.sparkfun.com/commerce/product_info.php?products_id=255) are parallel and have seventeen thousand wires coming off of them (or ~11 to 14). The most esteemed Ladyada Limor Fried has a nice tutorial on hooking one up here: http://www.ladyada.net/learn/arduino/lcd.html

I didn't want to eat up that many pins on the Arduino because I wasn't sure how many would be needed for everything else when I started, so I took the easy route and ordered a serial LCD that sends all the data over a single wire for $25: http://www.sparkfun.com/commerce/product_info.php?products_id=461

This was plugged into pin 7 on our project, but any digital pin would work depending on your sketch.

I look for these types of shortcuts a lot these days because my time is so limited. If I can cheat a little and make things go quicker for an $11 premium I'm all for it!


Posted by: zack on April 7, 2009 at 5:40 PM

HELP!

ok i have all the parts, but two things lie in my way... a LCD screen i dont know how to wire it has 14 holes for wires, three of wich are squares, i bought it from fungizmos.com and the WiiCosterUI when ever i try to upload the program it gives me an error code as seen below

23: error: LCDSerial.h: No such file or directory In function 'void setup()':
In function 'void loop()':

exactly as you see it above is what i get in the black box in the IDE window. the ardunio is not broken, i tried some exapmle sketches and they work. any help any one can offer would be great!

-Zack


Posted by: Make: television on April 8, 2009 at 11:30 AM

@zack, the estimable John Park has already answered your first question. If you scroll up a comment or two, you'll find this link (http://www.ladyada.net/learn/arduino/lcd.html) to a nice tutorial on how to hook up your LCD screen.

To answer your second question, I suspect that the error could be caused by having incorrectly hooked up your LCD screen. But I've notified John of your comment, and he'll have a better idea than I do about how to fix that.


Posted by: Tod E. Kurt on April 8, 2009 at 12:26 PM

Hi Zack,

Here's the steps I use to get WiiCoasterUI working:
1. Download WiiCoasterUI.zip from the link at http://blog.makezine.com/archive/2009/02/personal_flight_recorder_program_fo.html
2. Unzip WiiCoasterUI.zip to a directory (don't use Window's ability to double-click into a zipfile like a folder, actually extract all the files)
3. Go into the WiiCoasterUI folder. You should five files, one of which is "WiiCoasterUI.pde".
4. Open up WiiCoasterUI.pde using Arduino software, version 0015 or above. If you have an older version of the Arduino software, get the latest from http://arduino.cc/
5. Press the "Verify" button (looks like a play button)
6. The Arduino software should say "Binary sketch size: 6026 bytes" or similar.
7. Press the "Upload" button to upload to your Arduino board.

Now until you have the Sparkfun Serial LCD, this Arduino sketch won't be of much use to you.

(Aside: this sketch does some kind of advanced tricks with I2C to talk to the Wii Nunchuck. It doesn't use the standard "Wire" library to talk I2C. This was because it was part of a larger project that needed to be as small as possible)


Posted by: zack on April 8, 2009 at 1:53 PM

ok so...

Ok so your telling me that I have to use the sparkfun LCD and only the sparkfun LCD for the code to work? Why? By the way i have pressed the verift button, i got the same message.

-Thanks


Posted by: Tod E. Kurt on April 8, 2009 at 9:24 PM

Your serial LCD might work. You'd have to compare the command set used by it and that used by the Sparkfun LCD. If they are similar enough, the WiiCoasterUI sketch will work. Otherwise, you'll have to change it in a few places to make it match your LCD's command set. These are probably pretty small changes, just setting a different command byte for things like "go to position x,y".

As for why the sketch isn't compiling for you, it's hard to debug your situation without knowing more of your setup. What operating system are you on? What version of the Arduino software are you using? What kind of Arduino board are you using? Are you working from a fresh, fully unzipped version of the WiiCoasterUI sketch? Do you have all 5 files in the WiiCoasterUI directory? Have you gotten any other Arduino sketches to work?


Posted by: zack on April 8, 2009 at 2:23 PM

Here is a data sheet for my LCD screen, all I need to know is what pin holes to use. I have never worked with a LCD screen before.

http://www.newhavendisplay.com/specs/NHD-0216K3Z-FL-GBW.pdf


Posted by: zack on April 9, 2009 at 5:41 AM

ok.

I am using the Windows version. I am using the Arduino - 0015 Programming Enviroment; with the Ardunio Duemilanove with the ATmega328 chip. I have the WiiCosterUI fully unziped and have the folowing items inside:

-applet folder
-Ardunio software
-WiiCosterUI.pde

And yes I have tried other sketches and they work fine. Could you possibly tell me what I should change in the code to make this work?

Thanks
-Zack


Posted by: Tod E. Kurt on April 9, 2009 at 11:56 AM

Hi Zack,

Ah, there's your problem. Somehow you only have the one file (WiiCoasterUI.pde) where you should have a folder called WiiCoasterUI with 5 files inside of it. Did you download this zip file:
http://cachefly.oreilly.com/make/television/09/WiiCoasterUI.zip
Unzip it and you should have a folder called WiiCoasterUI with 5 files in it:
- WiiCoasterUI.pde
- wiichuck_funcs.h
- twi_funcs.h
- LCDSerial.h
- LCDSerial.cpp


Posted by: zack on April 9, 2009 at 12:04 PM

Ok, I have those files now...so whay do I do? Copy and paste into the WiiCoasterUI.pde on the Ardunio software?


Posted by: Tod E. Kurt on April 9, 2009 at 2:20 PM

Just run the Arduino software, and from within it, open the WiiCoasterUI.pde file. The software should open it and the other 4 files too.


Posted by: zack on April 9, 2009 at 9:11 PM

broken link

I am sorry to be such a pain, but the links supplied by all these comments and videos/web pages dont work anymore. I click download, it downloads fine, but once i try to extract the files... nothing. No files. Not a single thing. It may be just my computer, but now I cannot do anything.


Posted by: Make: television on April 10, 2009 at 7:26 AM

@ Zack, Sorry, I'm not able to replicate your problem. All of the links are live and the zip file should contain all of the files you need.


Posted by: Elliott on April 11, 2009 at 6:39 AM

Incorrect Something

I am not quite sure what is happening here. I am following all the directions correctly, except I am not using the ThingM adapter just the I2C bus wires. I can get valid data over the console, so I know my WiiChuck data transfer is functioning correctly.

Where I get the problem is on the LCD (a serial LCD from Sparkfun). When I re-power the board using a 5V supply all I get is invalid character streams on the LCD. I can press the WiiChuck buttons and move the joystick and this stream changes, but it is still an invalid data stream.

Any thoughts?


Posted by: zack on April 11, 2009 at 8:03 AM

nevermind

i got it to work again, the link that is. but i am still having trouble with the code.


Posted by: TXTCLA55 on April 11, 2009 at 11:50 AM

agreed

i cant get it to work either. code is broken.


Posted by: John Park on April 16, 2009 at 9:38 PM

Zack, are your code troubles with changing things to work with your particular serial LCD?


Posted by: dale on January 2, 2010 at 5:06 PM

John,
Please see my reply to Zach about the code not compiling. Any suggestions?


Posted by: Jim on April 30, 2009 at 11:13 PM

Mac program

Great tutorial! Just out of curiosity, what program did you use to display the output of the wii nunchuck when you demo'd it in the video? (It showed a graph of the G-force output)

Thanks


Posted by: John Park on May 1, 2009 at 9:33 AM

Darwin Remote

Thanks, glad you liked it! I used the excellent, open source Darwin Remote software to do the visualizations on my trusty 12" G4 PowerMac. You can download it here: http://sourceforge.net/projects/darwiin-remote/


Posted by: Zack on May 1, 2009 at 9:29 PM

I don't know anymore

I dont know; I have had problems galore on this project....it seems to be one error code after another. Plus I cant even wire my LCD screen as directed by ladyada mainly because I never did anything like this before. The main error code I get now when I try to verify the code is as follows:

C;\DOCUME~1\Zack\LOCALS~1\build12989.tmp\/wiichuck_funcs.h: In function 'void wiichuck_setpowerpins()':

C;\DOCUME~1\Zack\LOCALS~1\build12989.tmp\/wiichuck_funcs.h:60: error: 'PC3' was not declared in this scope

C;\DOCUME~1\Zack\LOCALS~1\build12989.tmp\/wiichuck_funcs.h:60: error: 'PC3' was not declared in this scope


Posted by: dale on January 2, 2010 at 5:02 PM

I'm having exactly the same problem as Zack above (with the code--my LCD is working fine and displays WiiCoaster (only)) It seems that something has changed in the arduino toolset that is causing the program to not compile. If I change the lines where PC2 and PC3 are being used in the define to 2 and 3 respectively (since that is what the ultimately defined as) I can get the code to compile, but when I run it the wiichuck_begin routine blocks in the call to twi_writeTo. Any suggestions, please? I suspect that the problem is deeper than just the definitions of PC2 and PC3, since I assume that at one time the project did compile correctly?


Posted by: John Park on January 2, 2010 at 5:52 PM

Dale and Zack, I'll give this a shot as soon as I can and see if I get any compile errors.
-John


Posted by: John Park on January 2, 2010 at 6:05 PM

Here's what Tod says:

"Yeah there's a small bug in avr-gcc when using an ATmega328. It's really annoying. They left out all the PCx defines. Change "PC2" to "PORTC2" and "PC3" to "PORTC3" and it'll work."


Posted by: dale on January 3, 2010 at 12:19 PM

John,
I explored this problem a bit more. It does not appear that the code was ever successfully working with a Duemilanove with an ATmega328. Not only is there the compliation problem with PC2 and PC3, but in twi_funcs.h there is a #if defined statment that needs to have __AVR_ATmega328P__ added to it.

Even after I fix the #if define line, however, I still find that the code hangs. It hangs on the line of code in twi_writeTo() that reads:
TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA);

I put a Serial.print before and after this line and the second Serial.print never happens.
Any help with this would be greatly appreciated.


Posted by: dale on January 4, 2010 at 8:08 AM

I will answer my own question. It is true that the code provided does not work with a Duemilanove with an ATmega328. I replaced the wiichuck_funcs.h and twi_func.h with code that uses the standard wire library (from Tod Kurt at http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/ and it worked after changing the names of the routines.

I still have one question: The code has some fragments for "Record" mode. Where can I find some code that will record the data onto a flash USB (or other) drive?


Posted by: John Park on January 17, 2010 at 10:32 PM

Hi, yes, we'll try to resurrect the record-mode code and post it soon. We had it writing out to an SD-card along with GPS data on an Adafruit GPS shield.


Posted by: dale on January 2, 2010 at 7:35 PM

John,
I changed the definitions as you suggested and it now compiles (as it did when I just used the constants 2 and 3 instead of PC2 and PC3). However after loading the program onto the board it still blocks in the twi_writeTo call in wiichuck_begin(). I put a Serial.print() before and after this call and viewed the output in the Serial Monitor on the PC. The first print shows up, the second one never does. The power and ground are present on Analog pins 2 and 3 as expected. I've tried with two different WiiChuck that both work with a Wii. I've verified that the WiiChuck is plugged into the adapter board correctly. Any idea how to figure out why the wiichuck is not initializing?

Thanks!


Posted by: skylar on February 6, 2010 at 5:20 PM

help!

Hey, Im having a problem with my build. I have everything working except for the LCD. This is the one I have: http://www.sparkfun.com/commerce/product_info.php?products_id=9395

When I turn the Arduino Atmega 368 on, the LCD just displays "WiiCoasterUI". It is not effected by the Wii Nunchuk at all. Help?! I even changed the PC2 and PC3 in the code to PORTC2 and PORTC3.


Leave a comment


Subscribe to MAKE!Subscribe to MAKE Magazine!

Subscribe today, save 42% and get web access to MAKE free. MAKE Digital Edition is available only to subscribers.

$34.95 / 1 year
(4 Quarterly Issues)

Subscribe now


Void your warranty, violate a user agreement, fry a circuit, blow a fuse, poke an eye out. Make: The risk-takers, the doers, the makers of things... Welcome to Make: Online!


CRAFT Maker Shed Maker Faire MAKE television




Check out more videos from MAKE.

Maker SHED

Connect with MAKE

Be a MAKE fan on Facebook MAKE on Facebook
Visit our Facebook page and become a fan of MAKE!
MAKE on Twitter MAKE on Twitter
Follow our MAKE tweets!
MAKE Flickr Pool MAKE on Flickr
Join our MAKE Flickr Pool!
    make_tips on Twitter



    MAKE Archives

    Make: Money

    Make: Science Room
    Subscribe to MAKE Magazine!

    Make: Online editors and authors!

    Gareth BranwynGareth Branwyn
    Editor-in-Chief


    Phillip TorronePhillip Torrone
    Senior Editor
    | Web | Twitter


    Becky SternBecky Stern
    Associate Editor
    | AIM | Twitter


    Marc de VinckMarc de Vinck
    Contributing Writer
    | AIM | Twitter


    John ParkJohn Park
    Contributing Writer
    | Twitter


    Sean RaganSean Ragan
    Contributing Writer
    | Twitter


    Matt MetsMatt Mets
    Contributing Writer
    | AIM | Twitter


    Dale DoughertyDale Dougherty
    Editor & Publisher
    | Twitter


    Shawn ConnallyShawn Connally
    Managing Editor
    | Twitter


    Goli MohammadiGoli Mohammadi
    Associate Managing Editor

    Kip KayKip Kay
    Weekend Projects
    | AIM | Twitter


    Collin CunninghamCollin Cunningham
    Contributing Writer
    | AIM | Twitter

    Adam FlahertyAdam Flaherty
    Contributing Writer
    | AIM | Twitter


    John BaichtalJohn Baichtal
    Contributing Writer
    | AIM | Twitter



    More contributors: Mark Frauenfelder (Editor-in-Chief, MAKE magazine), Kipp Bradford (Technical Consultant/Writer), Chris Connors (Education), Diana Eng (Guest Author), Peter Horvath (Intern), Brian Jepson (O'Reilly Media), Robert Bruce Thompson (Science Room)

    Suggest a Site!

    Advertise here with FM.

    Why advertise on MAKE?
    Read what folks are saying about us!

    Click here to advertise on MAKE!



    Current Podcast

    itunesdl.gif Behind the Scenes at MAKE and CRAFT In January, many of the remote MAKE/CRAFT team members (myself included) convened at the Maker Media headquarters at O'Reilly Media in Sebastopol, California. Take a look behind the scenes of your favorite DIY publications as Goli Mohammadi gives us... More...

    Get the Make: Online sent via email
    Enter your email to receive Make: Online each day:



    Sign up for the Make: Newsletter

    Our Make: Newsletter covers news from maker Media, has original columns, Shed deals, and more! You can also read the archives of past issues.


     



    MAKE Fascination video series brought to you by Dow

    Make: Education
    MAKE: en EspaƱol MAKE: Japan
    Important please read


    Subscribe to MAKE Magazine!

    Recent Posts from the Craft: Blog