Saturday was an exhausting but extremely fulfilling day of sun, technology and inquisitive youth. Best of all, I got to wear my sexy and luminous Technocamps t-shirt.
Technocamps is an outreach project I’ve been involved with since December. Primarily we visit schools to run computer science workshops. Initially providing demonstrator support, I have started to lead workshops and was recently asked to create some small robots to demonstrate arduino technology.
Though workshops aren’t the only engagement. Today we had the Beach Lab, occupying the bandstand in Aberystwyth we had everything from chatbots to textile electronics to aerial photography; engaging with multiple groups from within the University.
I myself managed a couple of robots – photophobic and photophillic, using torches to manipulate them which kids really seemed to enjoy. Though worried this might not be entertaining enough, I provided an arduino and breadboard with a variety of sensors and a multimeter for more curious minds.
I found the enthusiasm from the children extremely encouraging and not only was interacting with them fulfilling, but I am confident that the next generation will be filled with some excellent computer scientists.
This has been one of my favourite engagements with Technocamps so far; I can’t wait for the next one.
After an exceedingly successful Show and Tell in March we held another yesterday, Friday 11th March. Once again there was a great range of fantastic contributions and significantly increased food and drink.
The prize this time was a great Arduino Lilypad prototyping kit and was won by Mathew Keegan who delivered an absolutely brilliant presentation on Turing tests for school children.
Once again there were lots of robots and miscellaneous arduino projects and one of the elusive Raspberry Pis!
I violated the tech-related rule and brought along some special hot sauces for people try:
Though I also compared a couple of robots I’ve built, and a foetal ultrasound sensor I’m toying with:
These events are always extremely enthusing and reveal some of the great work people are quietly tinkering away on that would normally be completely unseen. Hopefully we’ll be doing another one at the start of the next academic year.
Although I’ve played with other people’s arduinos before, I’ve never been much of a hardware person. But arduino seems prevalent in computer science teaching and outreach, so I decided to increase my familiarity so that I could find a way to introduce programming to my little brother. After a few months of forgetting about it, and a couple of productive days, it turned out to be quite easy to put together:
The sonars were giving me some trouble, but that seems to be solved now.
It has 4 sonar sensors, bluetooth, 16×2 LCD, 2W and solar power for the arduino. I say it’s finished – but that’s really only the hardware side. My next step is to do some development for android in order to create a bigtrak style interface to control the robot – but with the ability to create functions and more sophisticated flow control.
My playing with arudino isn’t over yet though. I’d also like to make a sleeker robot based on a remote control car, for racing. And I’ve just soldered together a USB host shield; there are some interesting security related applications for that.
Of course, with the Raspberry Pi on the verge of being tangible, that’s the device I’m really looking forward to hacking about with (one day..).
A long long time ago I attended a dorkbot meeting in Bristol. I thought it was fantastic – there was beer, technology and intelligent discussion. Seeking to recreate that atmosphere, on Wednesday with the support of BCS Mid-Wales we held a ‘Show and Tell’ event at Aberystwyth University.
The turnout was fantastic, 55 people signed in and a few more wandered in and out during the event. Everyone was welcome – we were set up in a route of travel, though the crowd was primarily Computer Science students, we had IMAPS students (one who won the arduino!) and a couple of IBERS and IGES students. Lots of beer and pizza was consumed, but most importantly, there was plenty of interesting presentations and cool projects on show. A handful of robots, plenty of arduino, nifty software and fantastic ideas.
There are videos available here and some photos here and here. Hopefully over the next few days I’ll add the videos to youtube, and consolidate photos on the original website.
It was energising to learn about the projects people have going on that they don’t normally have an excuse to share. I’m really pleased that the event was successful, and hope to do it again soon.
So today I discovered the MATLAB support package for Arduino. It’s just some serial communication with a small server program for the arduino – nothing you can’t do easily with Serial.IO.Ports (or in Linux, simply write to the approprate terminal device – more detail here).
The interface is pretty simple, here’s part of their sample:
C
1
2
3
4
5
6
7
8
9
10
%--connect tothe board
a=arduino('COM9')
%--specify pin mode
a.pinMode(4,'input');
a.pinMode(13,'output');
%--digitali/o
a.digitalRead(4)%read pin4
a.digitalWrite(13,0)%write0topin13
I’m a fan of ambient effects – enhancing user experience by moving beyond the usual display. I have an amBX kit which I’ve used for atmospheric lighting and mail alerts. I have been meaning to expand the ambient lighting of my system but I’ll be moving to a DIY arduino based system since I’d rather not invest in kit with a dubious future (the reason I got ambx in the first place was because it was cheap ‘cos no one was interested!). So my first thought was being able to have quick and dirty ambient notification of Matlab script status.
However, I think any half-serious programmer would choose to communicate between Matlab/Arduino with system calls or MEX code. The package is from the Classroom Resources Team, so I imagine it’s aimed at young students who may find it useful for quick, easy real-time interaction with their arduino.
I did a quick search for any projects using Matlab/Arduino, but didn’t find anything particularly special. Perhaps it’s a nice lightweight way for data acquisition as well. I just love how big Matlab is – the various teams that contribute it and the size and scope of the community.
Today I played with the CapSense library. Using just a resistor and some conductive material, you have a means to sense electrical capacitance. The coolest thing about it is that depending on the resistor used, you can use it as a proximity sensor – without contact. I used a a 1M resistor and had it working from about 2cm.
I did attempt to chain a dozen 1M resistors together, but it seems the capacitance of the broadboard causes wild fluctuations in results despite grounding. This even happened with a single resistor on a breadboard, so in the end I shoved the resistor straight into the Arduino. Much better.
And so I present another demo video, a further proof of concept for an arduino based theremin-like device:
One benefit with this technique is that you can create aerials, so it resembles a real theremin. I’ve only got one aerial to adjust tone, but a second could be easily added. I’m thinking a 20M resistor for tone control and 10M for volume.
I’m still using a piezo for output, but since there are considerably fewer delays in sensing input compared to the sonar module, the sound generated is much more continuous. In fact, until I add some normalisation/smoothing I had to extend the tone duration to get a more controlled sound (rather than to compensate for ping time). When I’ve got some bigger resistors I can work on normalising the values.
Like most arduino libraries, CapSense is easy to work with and has been demonstrated by people all over the web, so you should have no troubles getting started. Here’s a picture of the nasty hack that makes my sensor:
And the code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// include the library code:
#include<CapSense.h>
//setup capsense
CapSense cs=CapSense(27,28);
//set piezo pins
constintpiezo_Pin=46;
voidsetup(){
pinMode(piezo_Pin,OUTPUT);
Serial.begin(9600);
}
voidloop(){
longr=cs.capSense(40);//higher for more accuracy, but delay..
intt;
Serial.println(r);
//check for "reasonable" values, capsense is prone to noise in my configuration
if(r>=800)r=800;//play nice with playTone()
if(r>10){
t=(r *15)+100;//normalise at some point
playTone(200,t);//ideally lower, but leave play the tone for a short duration to make it seem like there is more control
}
}
voidplayTone(intduration,inttone){
for(longi=0;i<duration *1000L;i+=tone *2){
digitalWrite(piezo_Pin,HIGH);
delayMicroseconds(tone);
digitalWrite(piezo_Pin,LOW);
delayMicroseconds(tone);
}
}
It really is that simple! It’s worth exploring the CapSense code as well, it’s easy to understand and might be worth taking the time to reimplement/trimming it.
Since the hardware is so simple, all I’ll need now is a resistor and some tin foil to add a new button to projects as a quick fix.
Being able to interact this way is great, and I’m sure CapSense will be used for a great variety of UIs. I’m hoping to see a Star Trek style interface soon.
An almost identical circuit has been used to implement EMF detectors (also, a MAKE article here), which made me think of general magnetic field detectors and a blog on “sixth sense” magnet rings I read the other day (similar here). Could we implement user input using a Hall effect sensor (example here)? Combined with an electromagnet, we might even be able to produce feedback? erhaps with multiple sensors you could have some sort of gesture control, (eg swipe up/down for volume). Maybe create put an electromagnet in your mouse that fires when you get an email? I wouldn’t a serious resolution/range of IO values. but it would be a fun toy. As soon as I have some neodymium magnets, I know what I’ll be doing.
Playing with arduino some more, I decided to test a HC-SR04 ultrasonic ranger module I have. Ultrasonic range finders are very common with robots. There seems to be a choice of two for budget/hobbyist ultrasonic modules the HC-SR04 and the Parallax Ping))). The Ping))) is more expensive and doesn’t seem to be sold in any UK shops or eBay sellers, so I opted for the HC-SR04 which costs between £2.50 and £8 on eBay.
Either module seems pretty simple to use – the only difference being that the Ping))) module combines the trigger/echo pins into one. The Ping))) is used in an example on the arduino website here. I’ve put my modified version of the code below.
A terse datasheet for the module is available here, which details the timing of the trigger wave. The specs for the module are: 5V DC, 2-500cm effective distance, 15 degree effectual angle and 3cm resolution.
C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Jonathan Francis Roscoe <jonathan@alt42.com>
Uses the HC-SR04 module to print a distance in CM to an LCD.
The Parallax PING))) module seems very similar but combines the trigger/echo ping into one, so this code won't work.
The module I used is available easily and cheaply, eBay is probably the best place.
*/
// include the library code:
#include
//LiquidCrystal(rs, enable, d4, d5, d6, d7)
LiquidCrystal lcd(11,10,4,5,6,7);
//set US pins
constintus_trigPin=45;
constintus_echoPin=44;
//variables we'll use
longduration,cm;
voidsetup(){
//set the ultrasonic pins up
pinMode(us_trigPin,OUTPUT);
pinMode(us_echoPin,INPUT);
//set the lcd
lcd.begin(16,2);
}
voidloop(){
lcd.clear();
lcd.setCursor(0,0);
lcd.print(getDistanceAsCM());
lcd.print("cm");
//a delay is necessary to prevent the echo of an earlier ping being perceived - otherwise we get inaccurately short distances
delay(100);
}
longgetDistanceAsCM(){
//send trigger signal
digitalWrite(us_trigPin,HIGH);
digitalWrite(us_trigPin,LOW);
//get the time to receive rebound
duration=pulseIn(us_echoPin,HIGH);
//sonar math is nicely explained in manual for the branded PING)) module here: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
//results seem accurate:
returnduration/29/2;
}
As I had a piezo lying around, I plugged it in to try and create a crude hands free tone generator – the idea being that I want to replicate this with capsense and a better audio component for a theremin like device.
It’s been a few years since I had my soldering iron out, but with a bit of space and holiday time over Christmas, I thought I’d finally play around with Arduino – a platform I’ve looked at enviously since a dorkbot meeting many years ago.
To get started, I’ve picked up a Dagu Red Black Spider Robot Controller. Now, this thing is officially designed with projects consisting of many servos – walking, waving bots. I don’t have any such robots in mind, but I think it’ll be a good general purpose piece of kit. The board is Arduino Mega compatible (probably the least “compatible” variant amongst arduinos), the older ATmega1280 version. But it packs a whopping 128k of flash memory and with 70 male/female IO headers I shouldn’t have to worry about running out of pins any time soon.
Of course, some people argue that Arduino boards are just overpriced microcontrollers. But I’ve played about in the past with microcontroller programming and the hardware side has always been difficult for me. I’m glad to finally have a nice and convenient breakout board and I’m looking forward to working with some shields.
At the moment I’m sourcing some components most of these were found on eBay, coming from China for economy. So it will be a few weeks before I actually play around with it. And since my wire stripper is missing I spent yesterday using my teeth to strip wires so I could test a HD44780 LCD. It worked, so I’m happy but I will be getting some new strippers ASAP. A particularly interesting component I want is a rotary connector or split ring. These allow transmission of power/data throught a rotating element – particularly useful for persistence of vision projects or perhaps a unidirectional, rotating sensor. These are proving scarce, with the ones I can find being expensive. Fortunately VCR players contain them, so I might explore some charity shops or freecycle.
I’m looking forward to playing about with the board and getting some more experience with lower level code – it’s an area I’ve managed to gloss over quite a lot.