Category Archives: prototype

Tribeca Hacks StoryMatter Hackathon at CERN

Team3 on the balcony at CERN

In March 2014, I was over the moon to be selected to take part in the Tribeca Hacks and CERN’s StoryMatter Hackathon, at CERN in Geneva, Switzerland. It’s really hard to write about this amazing experience in a short blog post, which is why it’s taken so long to write, but I’ve had a go!

Watch this amazing documentary of our week at CERN – it gives me goosebumps!

After taking the CERN shuttlebus to the familiar sight of CERN reception at Meyrin, I can’t put into words how excited I was to be back at CERN, and then sitting in the Geneva afternoon sunshine and meeting the steady stream of other attendees arriving. I stayed in Building 38, one of the three buildings at CERN, which offer different kinds of visitor accommodation. Building 38 is the on site-hostel which is comfortable and next door to the main restaurant which is large and has lots of different food options for the discerning CERN employee or visitor.

It's a beautiful sunny day at CERN

On the evening of our arrival, we all met for dinner in the main restaurant building and found our teams. Each of the 7 teams had 6 members that included: 1 x blackbox, 1 x storyteller, 1 x scientist, 1 x designer and 2 x technologists. It was really exciting to meet my team, which we later named Team 3, in the flesh after spending a week or so chatting about our ideas on Google Hangout and exchanging emails. My team consisted of Ivaylo Getov (Blackbox, from NYC, USA), Jason Wishnow (Storyteller from NYC, USA), Jasmine Idun Lyman (Designer from Gothenburg, Sweden), Kyle Gustafson (Scientist from Lausanne, Switzerland) and Julian Maciejewski (Technologist from Warsaw, Poland) and me, another technologist from London, UK. As we were quite an opinionated bunch with much experience of developing and managing our own projects and creativity, it took a bit of time to brainstorm through the set of ideas that we’d each percolated over on the week or so on the run up to coming to CERN and agree on an idea to pursue.

Idealab

Welcome talk

We had a beautiful week at CERN weather-wise and awoke every morning to the sight of sunshine bouncing off the surrounding Alps and Jura mountains. On our first morning (and the rest) we were up very early (I got up at 5 or 6am every day) and were taken to the CERN Idealab, which would be our base for the coming week. Organisers: Opeyemi Olukemi, Manager, TFI Digital Initiatives, Amelie Leenhardt, Program Coordinator, TFI Digital Initiatives and Neal David Hartman, Artistic Director of CineGlobe Film Festival, led the introductions and outline of the week ahead. Our mission was to investigate new ways of telling science stories in a non-linear fashion, using technology, and our challenges were to come up with a prototype and/or a video to outline and document our projects to show at the end of the week at the prestigious CineGlobe Science Film Festival, held in the Globe at CERN, plus to strengthen connections between the disciplines of storytelling, technology, design and science, hence having a cross-disciplinary team.

Rummaging through CERN bins for parts

Amazingly, we were allowed to rummage in a couple of skips of electronics to look for inspiration for our projects, we had so much fun finding odd devices, bits of old interfaces and computer boards!

Prof John Ellis talk on CERN

On our first day we were wonderfully honoured to be given a talk on the history and work of CERN by Professor John Ellis, including an introduction to how the LHC works, particle physics and supersymmetry, he patiently answered lots of questions from us too. We were also very admiring of his Standard Model equation tank-top!

Last minute hacking

Our team decided to make an app telling the story of dark matter, our prototype uses interview clips that we recorded on site with Professor Martin Pohl, Director of the Nuclear and Particle Physics Department at the University of Geneva, and Team Leader on the AMS (Alpha Magnetic Spectrometer) project. The AMS is a particle detector bolted onto the International Space Station and is looking for evidence of antimatter and dark matter as it orbits the Earth.

Team³ late Sunday night hacking

Taken from our blurb, this reflects what we were interested in creating:
“Axion invites a player to immerse themselves in a unique audiovisual world and reflect on their journey. By allowing a player to discover the thoughts and statements of these scientists, we hope to draw a parallel between the visual poetry and the scientific language, illuminating a creative and expressive side of the discussion that is often not showcased, or that most people outside the scientific community do not hear. We want to leave the viewer not with answers, but with a sense that it is acceptable to be uncertain – realizing that the method of science is not the ultimate source of answers, but rather a way to ask questions.”

It's a BillT!

On day three, we had some special visitors who had come to hear about the StoryMatter Hackathon – it was none other than Bill Thompson, Gareth Mitchell and Colin Grant of BBC World Service technology programme Click Radio, they made a lovely radio programme about the StoryMatter Hackathon and interviewed us about our project. Another special visitor was David Reid from BBC Click TV programme, who made a film about the CineGlobe festival including coverage of the development of our apps at the Hackathon.

Team3 being interviewed for BBC World ServiceClick

Our team worked long hours and had little sleep during the week as we figured out what we would make and how. We constructed our non-linear app, which we called Axion (a hypothetical elementary particle) by taking an XBOX Kinect strapped onto a camera into the depths of the tunnels under the buildings of CERN to film and turn images of the tunnels into a mesh construct, which the user of the app would navigate around to find interview clips from Professor Pohl. We made sound recordings from around CERN to be used in the soundtrack and searched for inspiring images from outer and inner space. My contribution was an sensing e-textiles device which was used to navigate around the mesh tunnels in the app and we called The Oracle!

During our week at CERN, it was Paolo’s birthday, he didn’t think anyone knew, but we put on a surprise birthday party for him, with caek, music and bubbles – it was wonderful and a very touching way to celebrate our new friend’s special day!

Birthday party for Paulo

Visiting ATLAS at CERN

Our stay was full of amazing highlights and another was a tour of ATLAS (A Toroidal LHC Apparatus) http://home.web.cern.ch/about/experiments/atlas, which is one of the seven experiments attached to the Large Hadron Collider particle accelerator. We took a lift 100 meters underneath CERN’s Meyrin Campus to visit 7000-tonne ATLAS. As well as listening in awe to our guide and taking many photos, we also (with the permission of the guide) wore some of Jasmine’s knitted gas-masks and did a quick bit of filming for a film she was making back in Sweden. The knitted gas-masks gave a fun and surreal feel to our trip; they certainly amused the rest of our StoryMatter tour party!

Visiting ATLAS at CERN

Opeyemi and Amelie set us tasks for every day of the week, including setting our milestones and actions to enable us to stay focussed on our projects. Everyone worked so hard on their prototypes that the presentation evening at CineGlobe came all too soon, during the late afternoon we took our prototypes over to the CERN Globe and set them up and rehearsed among ourselves our presentations to do on stage to the 200+ attendees. We had a brilliant evening of presenting and a lovely cocktail event after where the attendees came round and partook in demos and chatted to the teams.

Pretty CERN Globe at night

Finally presenting our hacks at CineGlobe Festival

Afterwards we had a raucous party in the Idealab with trays of lasagne, pizza, beers, wine and more. The dancing went on all night and into the morning. I only had a few hours sleep before it was time to get up and pack to leave, I was very sad to leave CERN and it was heart wrenching to say goodbye to everyone. I had the most brilliant week, with the most talented and wonderful new friends, which was amazingly well organised by Opeyemi, Amelie and Neal, plus with the help of brilliant CERN staff and students too numerous to mention, who helped us locate tools, interviewees, beg and borrow kit and info. If I had the opportunity I would go back to CERN without hesitation and have keeping an eye out for jobs and other creative opportunities.

StoryMatter hack party

I have a ton of photos here if you’d like to see more of the antics we got up to!

Route Marie Curie at CERN

Finally presenting our hacks at CineGlobe Festival

Team3 are still developing our Axion app in our spare time and keeping in touch across 1000s of miles around the globe via Google Hangout and email. We are now using a NeuroSky MindWave EEG headset to allow the user to navigate the tunnels and interviews of our app. We have also interviewed more scientists to broaden the range of the stories about dark matter. We’ve also been applying for development grants and sponsorship to help us develop Axion. In April, Ivaylo and Jason took Axion to the Tribeca Interactive Festival, in New York, to demonstrate and allow attendees to experience it.

Finally presenting our hacks at CineGlobe Festival

Finally presenting our hacks at CineGlobe Festival

You make my heart flutter – wearable sensing device & Heart Spark hack

For the past few weeks I’ve been working on the first stage of a project that involves hacking Eric Boyd’s excellent Heart Spark PCB pendant and combining it with a sensor module I’ve made from scratch.

Heart Spark: I uploaded a sketch (code) via fangled FTDI + some header pins

The Heart Spark pulses 6 LEDs to my heartbeat via a signal from my Polar gym chest band transmitter (that usually transmits / displays my heart rate on my Polar wrist watch). The Heart Spark is open source and Eric has kindly made the schematics, code, plus lots of other information available on the Sensebridge.net website pages for the Heart Spark. http://sensebridge.net/projects/heart-spark/

I’m very interested in how sensing technology can display vital signs and how this can be monitored and combined with other tech to give us an insight into our moods, and how our body is reacting to certain situations.

'You make my <3 flutter'

For this proof of concept, here’s the back story / premise I used when considering what I wanted to build and present at Rewired State’s recent (H)activate hack weekend at the Guardian:

“Geeks are very particular about their personal space, so what could be better than a mobile, wearable device that notes their heart rate when someone comes close. Whether you’re cool, calm and collected or get palpitations when a certain someone enters your space, it’s interesting to note how a particular person affects your physicality, whether that be geek love or geek annoyance. It’s not quite your heart on your sleeve, but round your neck!”

For this, I’ve created a heart-shaped proximity detector module to link to the Heart Spark – I’ve named this ‘Flutter’.

To create the Flutter module, firstly I experimented with various combinations of components: an IR proximity sensor, resistor, potentiometer, LED and transistor on a breadboard. The 3.3V coin cell battery that powers the Heart Spark could not give enough output, even when combining with a step up component which boosted the voltage up to 5V to power both the Heart Spark and the proximity sensor.

Circuit diagram for 'You make my <3 flutter'

So I began a period of trial and error with various combinations of batteries, resistors, transistors and twiddling the potentiometer. In the end I gave up fiddling and got my oscilloscope out to find out what was happening. I got some very curious signals from the various battery combinations and step up module I was using, but in the end the solution was to get more juice to the IR proximity sensor. This meant powering it separately and that more batteries were needed. So I settled on a 3 x AA battery pack, for which I’ve made a fabric heart shaped pouch dangling on a twisted twill rope, as it needs to be housed quite close and precisely to the sensor via battery pack connectors.

Hacking the Heart Spark with a proximity sensor - testing on the sillyscope

I have to say, I really feel that powering wearable technology is one of the more irksome things about trying to get this technology into wearables and I’m going to blog about this soon. On that note, the reason I added a 10k Ohm potentiometer to the heart-shaped IR sensor was so that small tweaks to the voltage can be made to the sensor.

Creating a heart-shaped proximity dectector module

To house all the components and with the help of a hacksaw, I made a heart-shaped substrate out of stripboard and coloured it black with a marker pen.

Hacking the Heart Spark – I have hacked Eric’s original code so that the top 3 LEDs on the Heart Spark light up when the IR proximity sensor detects someone in my space. I have some more interesting ideas for the code to work with the Heart Spark in the future, but in the first instance my goal was to get the Heart Spark to acknowledge the IR sensor and light up from its signal.

Hacking the Heart Spark

To upload code from my laptop to the Heart Spark, I fangled an FTDI board (which I usually use with LilyPad Arduinos) with some header pins – so I could connect it to the headers on the Heart Spark. I also soldered two pin headers to ground and positive / signal pins on the Heart Spark, which allows wire connection between the Heart Spark and the Flutter module.

Hactivate: battery pouch made

Hactivate: You make my <3 flutter

Stage 2 and next steps…

For the next iteration, I’d like to add a tiny camera to this work, set to log periodic photos of who or what situation is in front of the wearer. Plus find a way of grabbing the photo, heartbeat and proximity sensor data from the devices and send to my laptop via a sewable a LilyPad Arduino x-Bee transmitter. Sewable, because I’d like it to become part of the heart-shaped battery pack pouch.

I want to graph the data from the two sensors to plot how many times during the day I get fluctuations in my heart rate when someone enters my space and would place the photos from the camera at appropriate points alongside, to see who had made my heart flutter. I’d use this information to work out my physiological state and reactions to certain situations, and people throughout the course of a day.

Other additions I’ve thought about are to include a temperature sensor, to record if someone becomes hot or flushed in certain situations or people and an accelerometer to assess body language by the user’s posture.

Mass participant uses? I’d love to hold a speed-dating event where all the participants wore the “You make my <3 flutter” device to attempt to determine people’s reaction to each other based on their physical data signals.

'You make my <3 flutter'

Thank yous to: Ciaran Anscomb and Eric Boyd for help and advice \o/

Temperature sensing t-shirt (AKA: “Yr in mah face!”)

'Yr in mah face' temp-sensing t-shirt

At last weekend’s 24-hour Pachube Hackathon, I created an electronic wearable I wasn’t expecting to make! To clarify that statement, I intended to hack on a LoL Shield I’d recently soldered together (it has 126 LEDs = steady hands needed & much love to the soldering iron ;-)). Unfortunately, I’d mislaid an accelerometer to interact with the LEDs, so it was no go for that hack…

Spaghetti croc clip testing works!

After spreading out all my spare LilyPad Arduino components and kit from my toolbox on the table at Pachube Hackathon, I decided on a new hack – a temperature sensing t-shirt! I spent some time writing and debugging the code before it would happily compile in the Arduino IDE. I then tested the code by uploading it to the LilyPad and connecting all the modules together with crocodile clips, and yay it worked!

Creating my hack: big heart cat heads

I’m very interested in interactive wearables and so decided to create a t-shirt that would use loop poll Celsius data from a sensor on the t-shirt and average them, then visualise the results. The tshirt uses sewable LilyPad Arduino modules and conductive thread to sew all the connections together.

I didn’t have much time left, once I’d got the code to compile and uploaded it, then tested everything together with the crocodile clips, so the designing, cutting out from fabric and sewing all the fabric and components together with conductive thread was a manic rush. No prizes for tidy sewing and elegant design I’m afraid, but a prototype conceived designed and built is less than 24 hours!

Creating my hack: big heart cat heads

So here’s the amusing concept scenario… imagine you’re a shy and retiring geek like me, who might find themselves in a social situation, such as a loud, crowded bar. The temperature sensing t-shirt I’m wearing has two cat heads: one green – the colour of cool, calm collected cat – its LED eyes signaling temperatures of less than 27 degrees Celsius, if the wearer were to say have someone at close proximity talking loudly at them, the heat from their breath would push the sensor Celsius average over this point and the LEDs would turn off on the cool calm collected green cat head and come on, on the hot, red, angry coloured cat head!

Creating my hack: early conductive thread sewing

This would be a signal to whomever is causing the angry red cat’s LEDs eyes to light up, to back off “You’re in mah face” or perhaps if the wearer is hot and embarrassed, to have a nice sit down in a corner with a cool drink of lemonade.

Creating my hack: woo done in the nick of time!

Creating my hack: back view, negotiating tracks of conductive thread

But seriously, my t-shirt is a fun proof of concept, I’m very interested in how sensing tech such as temperature sensors can have wider and useful usage. For example, in a society where more of the population is living to a ripe old age, then smart wearables such as temperature and other sensing modules can help older or disabled people, who might need their health monitoring constantly, carry on living at home for longer and keep their independence. Also, I can think of various lifestyle and sporting uses, such as comfortable sports clothes that would also have reasons to track data, plus smart clothing for people who work with extreme temperatures, chemicals or in harsh environments.

Me and my hack - yay it works!

Pachube International Internet of Things Hackathon, London

Pachube hackathon

A fantastically fun 24-hour hackathon organised by Pachube at 01 zero-one, in Soho, London. The hackathon was open to software and hardware hacking, the Pachube APIs, were available to use (hackers could of course use any other APIs of their choosing). The Hackathon was also simultaneously happening in other cities around the globe including Zurich, New York, Lancaster and Eindhoven.

When I arrived at 2pm on Friday, 01 zero-one was packed and I had to squeeze my way through tables of geeks to find a spot to set up my laptop and listen to the opening announcements and demos.

Paul Tanner at Pachube hackathon

Demos included Nanode by Ken Boak, Arkessa’s GSM modems, Paul Tanner on mbed, Adrian McEwen and Michael Margolis were on hand to help with any Arduino questions.

Ken Boak - Nanode

I had intended to hack on an Arduino Duemilanove driven disco shirt using a LoL Shield I’d recently soldered together = a charlieplexed matrix of 126 LEDs! Unfortunately I’d mislaid an accelerometer that was key to the work, so I had to give up on that idea (for now), but cheered myself up by chatting to friends about their hacks and making some new friends.

I did some mulling and consolidating of bits and pieces of LilyPad Arduino components I had with me and decided to start a new project from scratch. My new hack was to be a sensing t-shirt, using LilyPad Arduino, temperature sensor and LEDs. The premise of the t-shirt was to detect if someone was too close to you for comfort, say in a bar and if they were so in your face that the heat from their breath or that you might feel uncomfortable and get hotter – either heat causing a Celsius testing script to sense a temperature over a certain level. This status was reflected on the shirt by two cat heads with LEDs, one green to indicate being cool, calm and collected, the other red and angry/alarmed! Basically the looping script takes a number of sample temperature and averages them to find whether or not the situation is getting horribly hot – this is indicated in the LEDs of the appropriate colour cat head’s eyes lighting up!

Spaghetti croc clip testing works!

Creating my hack: big heart cat heads

On Friday evening I put the code together and spent a while debugging it to get it to compile. On Saturday morning I connected all the components with crocodile clips to test the code with the hardware – luckily it worked = hurrah! I spent a tense time during the run up till the presentations designing how the shirt should look, working out where the components would go, cutting-up fabric and sewing frantically with conductive thread!

Creating my hack: big heart cat heads

I was still sewing my hack together when the presentations started, which incurred some rather rushed stitching and some rubbish looking conductive thread bridges (to avoid shorts) on the back of the fabric!

I think I finally finished sewing about 10 mins before the end of presentations and gave a rather on-the-fly talk about my work as I hadn’t really had time to contemplate what I was going to say, but luckily my hack worked for the presentation and relief ensued.

Me and my hack - yay it works!

Presentations

There were some great hacks and some well deserved winners, such as the Waving Kitty, Marvin the Paranoid LaptopBot, Display Cabinet, Nanode hacks and an umbrella that turned lights on and off! I’m looking forward to hearing how the hacks progress…

Presentations: Sarah's Marvin the paranoid laptop bot

Hack winners: Dan, Tim & Ben

Sadly, it was all too soon time to go home, but I had a fabulous time, the welcome and hospitality from Pachube and 01 zero-one was fantastic – cheers guys!

Presentations: Umbreller

Presentations: Lucky Cat hack

Upcoming: Smart Fabrics 2011, London

I’m always on the lookout for interesting events that’ll help me develop my work and next week I’ll be going to the 7th annual Smart Fabrics conference in London on 4-6th April. I’m pretty excited about this as I’m hoping to see lots of innovation in fabric tech and inspiration for my future wearable electronics and artworks. What would be particuarly useful is some info on advancements in the durability of conductive threads, fabric and printed circuitry, plus I’ll be looking out for the latest news on sensors and lighting for wearables.

Electroluminescent me

Can’t wait to see some new creative applications and how e-textiles are being used in areas I haven’t really looked into yet such as medical and space tech and I’m hoping to be wowed by new tech in R&D and smart fabrics I’ll see in the future.

I’ll blog as much as I can and a try to find a Twitter stream for the event!

Conductive velcro has arrived!

Twinkle Tartiflette – an Arduino driven interactive word/music artwork

LilyPad Arduino is a great platform for rapid prototyping, for my standalone interactive art projects and wearable artworks. It’s also a fun way to learn about electronics and programming.

Here’s how I created Twinkle Tartiflette, an interactive artwork, using various LilyPad modules connected with conductive thread.
My inspiration came from a Stylophone Beat Box that I recently purchased as a present and had a play with. I pondered how one would go about making an interactive artwork using LilyPad components.

I decided that I wanted to combine words, image and sound into an interactive experience, brought to life by touching the words with a stylus. I began to think about how I’d build this and firstly decided on re-using the frequencies for notes worked out for a favourite ditty, Twinkle Twinkle Little Star, that I’d used in another artwork. I would transfer the first two verses word for word onto felt stars, one star for each verse.

Sewing Twinkle Tartiflette

There are 6 notes in the 2 verses so I needed to map out a schema for the conductive thread to pass from the words to the Lilypad, joining each word to the right note pin on the LilyPad – being careful to select conveniently located pins.
First I cut out 2 star shapes and began sewing the words onto them, not being an experienced embroiderer this wasn’t easy or terribly pretty.

After about a week of evenings I had two stars with conductive thread sewn words in the right order. I was mindful to sew the words carefully so frayed thread did not touch and cause any shorts – fabric glue is good for sticking down frayed thread and keeping close knots apart.

With the word stars completed it was time to deploy the main sewing schema – I’d mapped notes to the words and then words back to pins on the LilyPad.

Twinkle Tartiflette schema

After an intensive couple of weeks of sewing evenings later, I thought I’d sewn all the words to the right notes and pins, also adding buzzer and battery modules. There were some interesting insulation/bridging issues to be solved between the various paths of conductive thread, but I was ready to extract code ideas from my brain to see if it would compile!

The code I have written uses the speaker module to produce simple musical notes from connecting to the words with a stylus. I originally used a chart to match frequencies to the different notes.

Sewing Twinkle Tartiflette with conductive thread

With code loaded to the Lilypad, via an FTDI breakout board, it’s time to test – annoyingly there was a problem! The buzzer was not playing notes correctly, after some thinking and testing with a multimeter, croc clips and a single resistor – a solution was concluded – I’d need to add some resistors.

Unconnected the circuit is connected to high, but when the stylus touches a word it creates a simple circuit through the resistor and pulls it to low, but I needed some resistivity in-between. Looking through a ton of resistors 10k ohm seemed like a good fit, but where and how to add them was another question! A small LilyPad protoboard I had was just the job to solder the resistors to. I have six notes, so the protoboard was just right – I only had 5 x 10k ohm resistors, but found another resistor that was near enough to work (reading up later I found out that 20K pull-up resistors are built into the Atmega chip that can be accessed from software, so I didn’t really need need to add the resistors if I’d known that – hey ho, lesson learnt for next time!).

Soldering resistors to the protoboard

After some soldering, I had some more complex routing of conductive thread to do for the resistors on the protoboard. When testing I discovered I’d fix0red one problem, but had found another to debug! Earlier, I said to be mindful of the pins – I had accidentally connected to pin 13 which is the LED pin and has it’s own resistor which is set too low for this project. This showed up in resistance testing with the multimeter.

The fix for the wrong pin incurred some more unpicking and re-routing of conductive thread. I used an analogue pin as it was nearer and the least hassle to route to, this pin change required to be reflected in the code. Finally I decided the best thing to use for a stylus is a crocodile clip – which worked a treat.

Testing resistance with a multimeter

After all that, yay Twinkle Tartiflette lives! All that remained to do is tidy up the sewing, ensuring there are no trailing bits of conductive thread to cause shorts and gluing down anything looking like it was going to stray or come undone with fabric glue. Lots of lessons learnt, but hurrah!

Twinkle Tartiflette finished

Twinkle Tartiflette & Rain

I’ve made two videos for your delectation below – the first (00:44 secs) is a quick demo of me playing Twinkle Tartiflette.

This second video is an in-depth (05:40 mins) explanation of how I made TT, plus examples of debugging along the way – hope you enjoy!

Here is my code – you can use it via a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported license & I’d love to know if you do!

/*
* Rainycat’s LilyPad stylo style: sound used to power Twinkle Tartiflette
*
* Uses a LilyPad speaker module to produce simple musical notes from touching words to the song
* For a chart of the frequencies of different notes see:
* http://www.phy.mtu.edu/~suits/notefreqs.html
*/

int NotePinC6 = 0; // words connected to play note C6 analogue pin!
int NotePinG6 = 12; // words connected to play note G6
int NotePinA6 = 11; // words connected to play note A6
int NotePinF6 = 10; // words connected to play note F6
int NotePinE6 = 9; // words connected to play note E6
int NotePinD6 = 8; // words connected to play note D6
int speakerPin = 3; // speaker connected to digital pin 3

// A note in one octave is twice the frequency of the same note in the octave
// below. We define here the frequencies of the notes in octave 8. To get
// notes in lower octaves, we just divide by two however many times.

#define NOTE_C8 4186
#define NOTE_CSHARP8 4434
#define NOTE_D8 4698
#define NOTE_DSHARP8 4978
#define NOTE_E8 5274
#define NOTE_F8 5587
#define NOTE_FSHARP8 5919
#define NOTE_G8 6271
#define NOTE_GSHARP8 6644
#define NOTE_A8 7040
#define NOTE_ASHARP8 7458
#define NOTE_B8 7902

// This is an array of note frequencies. Index the array essentially by note
// letter multiplied by two (A = 0, B = 2, C = 4, etc.). Add one to index for
// “sharp” note. Where no sharp note exists, the natural note is just
// duplicated to make this indexing work. The play() function below does all
// of this for you :)

int octave_notes[14] = {
NOTE_A8, NOTE_ASHARP8,
NOTE_B8, NOTE_B8,
NOTE_C8, NOTE_CSHARP8,
NOTE_D8, NOTE_DSHARP8,
NOTE_E8, NOTE_E8,
NOTE_F8, NOTE_FSHARP8,
NOTE_G8, NOTE_GSHARP8,
};

// Arduino runs this bit of code first, then repeatedly calls loop() below. So
// all initialisation of variables and setting of initial pin modes (input or
// output) can be done here.

void setup() {
pinMode(13, INPUT); // make sure 13 is high impedance

//pinMode(NotePinC6, INPUT); — analogue pin automatically input
pinMode(NotePinG6, INPUT);
pinMode(NotePinA6, INPUT);
pinMode(NotePinF6, INPUT);
pinMode(NotePinE6, INPUT);
pinMode(NotePinD6, INPUT); // sets the ledPin to be an intput
pinMode(speakerPin, OUTPUT); // sets the speakerPin to be an output

}

// Arduino will run this over and over again once setup() is done.

void loop()
{

// special case hack for this pin:
if (analogRead(NotePinC6) < 256) {
play(speakerPin, "C6", 50);
}
if (digitalRead(NotePinG6) == LOW) {
play(speakerPin, "G6", 50);
}
if (digitalRead(NotePinA6) == LOW) {
play(speakerPin, "A6", 50);
}
if (digitalRead(NotePinF6) == LOW) {
play(speakerPin, "F6", 50);
}
if (digitalRead(NotePinE6) == LOW) {
play(speakerPin, "E6", 50);
}
if (digitalRead(NotePinD6) == LOW) {
play(speakerPin, "D6", 50);
}
}

// ————————————————————————-

// To produce a tone, this function toggles the speaker output pin at the
// desired frequency (in Hz). It calculates how many times to do this to
// produce a note of the desired length (in milliseconds).

void beep(unsigned char speakerPin, int frequency, long duration)
{

int i;
long delayAmount = (long)(1000000/frequency);
long loopTime = (long)((duration*1000)/(delayAmount*2));

//for (i = 0; i = ‘A’ && note[i] = ’0′ && note[i] >’ operator is a useful shorthand that (for integers
// >= 0) basically translates to “divide by two this many
// times”, so we will use that:

frequency = frequency >> (8 – octave_number);

// Actually play the note!
beep(speakerPin, frequency, duration);
}
}

Thinking Digital 2010: Arduino Power Workshop

Thinking Digital 2010 kicked off with a choice of fabulous pre-conference workshops covering compelling topics such as web video, visual communication, origami and pitching. As a microcontroller enthusiast, I couldn’t help but choose the Arduino Power workshop run by Daniel Soltis of Tinker, Jamie Allen of Culture Lab and Brian Degger.

Most of the workshop attendees were new to Arduino, which was a good thing – Daniel and Jamie gave an overview of Arduino, its uses and some examples of cool projects.

We were each given a fantastic Oomlout ARDX starter kit – which is a great kit for anyone starting out or wants a nice kit with a variety of parts for projects, followed by a walk-through of a few simple sketches as a nice intro to Arduino, then let loose with various cogs, propellers, wire, balsa wood, glue guns and other bits to build and experiment with.

I created a dancing kitty, fashioned from balsa wood in conjunction with Arduino and a few bits of kit and a sketch – to become a simple example of how one can use a DC motor with a propeller to power a servo.

Here’s a little video of the simple whimsical kitty I made:

I’ve been asked to publish the sketch for this, and as all the wonderful libraries and examples in Processing are open source I’ve posted it below. As with all sketches, you can modify them to your needs or tweak the values to suit your project.

For example, you can experiment by changing one of the values in the sketch below to get the best turning response from the servo. So in line val = map(val, 0, 1023, 0, 179); – I changed ’1023′ to the maximum value I got from the DC motor when spinning the propeller – I tested this using another sketch and while spinning the propeller and reading the voltage which in my case was ’45′.

You can just about see the breadboard / arduino pin layout in this photo:

Dancing Kitty breadboard / arduino layout

Knob sketch:

// Controlling a servo position using a potentiometer (variable resistor)
// by Michal Rinott

#include

Servo myservo; // create servo object to control a servo

int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}

Many thanks to Daniel, Jamie & Brian for a fab afternoon of fun & lovely ARDX kit :-D