Tag Archives: arduino

How to use Makey Makey as an Arduino

Our MakeyMakey arrived today (13 days after shipping (we were in the Kickstarter) for those counting) (and thankfully no problems with customs)!  Following the Howto as linked on the back of the board was great for the basic stuff (and I spent more time with the ‘one button games‘ that I should have) but I was immediately drawn to the arduino-ness of the board, but didn’t see anything on the HowTo page.  After digging through the forums and following a few links I’ve deduced the following setups:

  1. If you don’t already have an arduino, download the IDE
  2. Hit up the MakeyMakey Sparkfun page for links to the latest versions of the following.
  3. If you’re on windows, download the driver (presently here) and extract the folder somewhere on your system.  Open up ‘Device Manager’ and find the ‘USB IO’ device that’s unknown (unless of course you didn’t follow the Howto instructions on ignoring the pop-ups during first connection, then  you can just use those links), and click through to it to manually install the driver, and then browse to the place you extracted the ‘driver’ folder.
  4. Download the ‘Makey Makey Arduino Addon‘, which will have a ‘hardware’ folder and a readme.  Either read through the readme, or copy & paste the hardware folder to your ‘sketchbook location’ (find yours in your arduino environment under File->Preferences).  You can also find this on github here.  Having this in place means that under “Tools -> Board” in your sketch software you’ll now have the custom config for the MakeyMakey version of Arduino.
  5. If you want somewhere to start from — e.g. just want to alter what letters are assigned to which pins copy the files from this makey_makey github to a sketch folder and load it up and tweak.  This is also the code to reload your makey makey if you happen to have tried some other arduino program before you found this page and bricked your makey makey.

Hopefully I’ll post some updates as to what the kids come up with soon, but for now, here’s the ad from the makers of this open-source piece of awesome:

Sparkfun has a tutorial posted as well.

I can solder! 7-Segment Serial Display & Nunchucky operational

I’ve been toying around with some electronics projects the last few months, but have been putting off the basic requirement of actually soldering anything.  I got a basic iron and misc tools around 6 weeks ago, and a couple of components that needed assembly (piggy backed on our robot order) but just hadn’t made the leap.  Until now.

I started with the 7-Segment Serial Display (Blue) (ordered from Solorbotics) which needed a few wires attached if I was going to do any prototyping with it.  From looking around it looked like I only needed to wire-up the Gnd and the Vcc connections (these were labelled on the circuit board).  After putting way too much solder on the first pin (and subsequently using my ‘solder sucker’ to clean it up) the next pin went smoother.  After looking at some example code it became clear I also needed to wire up the “Rx” connection as well.  Three wires total soldered up.  Just plugging it into the arduino made it display 4 zeros so that told me it was operational.  Update: you don’t actually have to solder these wires on… just bending them through the holes would have worked too.

These projects are still a bit obscure for me, so I wasn’t sure how to get started.  I read through the User Manual which was clear enough, but I figured there was code out there already.  I found this wall of text which I managed to digest down into this gist (and updated it thanks to these notes) which you can see running in the above video.

// example of using 7-Segment Serial Display
// product available from https://www.sparkfun.com/products/9765
// based on code from http://www.arunet.co.uk/tkboyd/ec/ec1led4x7ser.htm
// Note: solder wires at Gnd/Vcc & Rx, Rx goes to a digital pin on the arduino.
// Video available at http://www.youtube.com/watch?v=YVMAzYqV4kg
// Blogged @ http://chrisnolan.ca/2012/08/05/i-can-solder-7-segment-serial-display-nunchucky-operational/
#include <SoftwareSerial.h> // Arduino 1.0 included
#define SerInToArdu 2
#define SerOutFrmArdu 3 // pin it's plugged into
#define wDelay 300//no ; here. Sets how long each "message" appears
SoftwareSerial mySerialPort(SerInToArdu,SerOutFrmArdu);
// The above creates the serial channel we will use.
void setup(){
pinMode(SerOutFrmArdu,OUTPUT);
pinMode(SerInToArdu,INPUT);//Not actually needed...
mySerialPort.begin(9600);
mySerialPort.print("v"); //To reset display module
};
void loop(){
default_example();
scroll_word("4321");
scroll_word("87654321");
scroll_word("HELLo noLAn");
scroll_word("123456789");
mySerialPort.print("xxxx");//Send an "x" to turn a digit off
delay(wDelay);
delay(wDelay);
};
void default_example() {
mySerialPort.print("1234");
delay(wDelay);
mySerialPort.print("234x");
delay(wDelay);
mySerialPort.print("34xx");
delay(wDelay);
mySerialPort.print("4xxx");
delay(wDelay);
mySerialPort.print("xxxx");
delay(wDelay);
mySerialPort.print("----");
delay(wDelay);
mySerialPort.print("8888");
delay(wDelay);
mySerialPort.print("HEL0");
delay(wDelay);
mySerialPort.print("NoLA");
delay(wDelay);
mySerialPort.print("oLAn");
delay(wDelay);
mySerialPort.print("LAnx");
delay(wDelay);
mySerialPort.print("Anxx");
delay(wDelay);
mySerialPort.print("nxxx");
delay(wDelay);
};
void scroll_word(String w) {
int length = w.length();
if (length <= 4) {
mySerialPort.print(w);
delay(wDelay);
} else {
w = " " + w + " ";
for (int i=0; i<= length+4; i++) {
mySerialPort.print(w.substring(i,i+4));
delay(wDelay);
}
}
}
view raw gistfile1.ino hosted with ❤ by GitHub

While the ‘iron was still hot’ (ok, not really but it sounded good — I actually waited until my son was home so he could watch) I put together the next project, which was a NunChucky Wii Nunchuck I2C Breakout Adapter .  This adapter required some headers (male & female) to be soldered on (while the WiiChuck wouldn’t have).  For the first bit of soldering I used my little ‘helping hands’ gizmo for holding both the circuit board, and the wire going in, so my hands were free; this time around I just set it on the table with the header poking through and soldering it that way.  This resulted in a slightly lop sided connection.  For the 2nd header, I used my other ‘helping hands’ (i.e. my son) to so we could solder with 4 hands instead of 2.  I made a video of the NunChucky in action too (and combined with the 7-Segment display) if you’re curious.

The code for the Nunchucky is based on Tod Kurt’s library (which he based on Chad Phillips code) and you can see my mods to his demo in this gist to output the button presses to the display.  Aside: did you know a “1” is different than a ‘1’ in Arduino?

/*
* WiiChuckDemo --
*
* 2008 Tod E. Kurt, http://thingm.com/
*
* with code for 7-Segment Display added by Chris Nolan.ca
* based on https://gist.github.com/3268581
*
*/
#include <Wire.h>
#include "nunchuck_funcs.h"
#include <SoftwareSerial.h>
int loop_cnt=0;
byte accx,accy,zbut,cbut;
int ledPin = 13;
#define SerInToArdu 2
#define SerOutFrmArdu 3
#define wDelay 300
SoftwareSerial mySerialPort(SerInToArdu,SerOutFrmArdu);
String seven_seg;
void setup()
{
pinMode(SerOutFrmArdu,OUTPUT);
mySerialPort.begin(9600);
mySerialPort.print("v");
seven_seg = "x--x";
mySerialPort.print(seven_seg);
Serial.begin(19200);
nunchuck_setpowerpins();
nunchuck_init(); // send the initilization handshake
Serial.print("WiiChuckDemo ready\n");
}
void loop()
{
if( loop_cnt > 100 ) { // every 100 msecs get new data
loop_cnt = 0;
nunchuck_get_data();
accx = nunchuck_accelx(); // ranges from approx 70 - 182
accy = nunchuck_accely(); // ranges from approx 65 - 173
zbut = nunchuck_zbutton();
cbut = nunchuck_cbutton();
Serial.print("accx: "); Serial.print((byte)accx,DEC);
Serial.print("\taccy: "); Serial.print((byte)accy,DEC);
Serial.print("\tzbut: "); Serial.print((byte)zbut,DEC);
Serial.print("\tcbut: "); Serial.print((byte)cbut,DEC);
if (zbut == 0) {
seven_seg.setCharAt(0, '0');
} else {
seven_seg.setCharAt(0, '1');
};
if (cbut == 0) {
seven_seg.setCharAt(3, '0');
} else {
seven_seg.setCharAt(3, '1');
};
mySerialPort.print(seven_seg);
Serial.print("\t7Seg: "); Serial.println(seven_seg);
}
loop_cnt++;
delay(1);
}
view raw gistfile1.ino hosted with ❤ by GitHub

Next time, don’t put off til tomorrow what you can do today.

What will you make?