?

Log in

No account? Create an account
Gavin Greig [userpic]

Arduino

April 1st, 2012 (10:02 pm)
current location: KY16 8SX

An Arduino UNO and accessories

Back in 1990 I was relieved to graduate with a 2:2 in Physics and Electronics, and the knowledge that whatever I was going to do next, I didn’t want it to involve Physics. A conversion M.Sc. to Computer Science came along, and having enjoyed the logical parts of Electronics, it turned out I was able to make a go of computing.

I think that probably the last time I had anything much to do with hands-on electronics was back then, when I created a voice-delay board for my Honours project; a project that would store up to eight seconds of speech at 8-bit quality, before playing it back.

For the last year or so, I’ve been intrigued by the idea of the Arduino (or a clone such as the Netduino, which allows you to use the .NET Micro Framework), a microprocessor with an environment of plug-in accessories that’s intended to make it easier for people – especially artists and designers – to achieve interesting things with electronics.

For this week off, I dug out the gas soldering iron I’ve had pretty much unused for ages, ordered a bunch of interesting sounding parts and, driven by visions of having a robot zipping about the place autonomously and chatting to people, I set out to see what I could achieve.

To avoid disappointment straight away, you possibly won’t be astonished to hear that there’s nothing to show you!

However, I did have fun tinkering with electronics and simple programming.

What you see in the picture above is an Arduino Uno (top left) connected to my PC via a USB cable and sitting on a base that also holds a breadboard for experimentation. Surrounding it are three “shields” that can be stacked on top of it and controlled by it. Going clockwise, they are an Ardumoto shield for powering electrical motors, a Voice Box shield for synthesising speech, and an EasyVR shield for voice recognition. Also in shot, some tools including a Portasol Technic butane-powered soldering iron, and an SRF02 Ultrasonic range finder.

I’ve tinkered a bit with each of them – enough to be sure I can get them working – but spent most time on getting the Voice Box shield to talk. This required some soldering to attach the ”headers” (the black strips of connectors that allow the shield to be stacked on top of the Arduino) and a couple of screw connectors that speaker wires could be pushed into.

In the process I found that I could still solder stuff, but wasn’t very good. Also that the gas soldering iron wasn’t very good for recovering from bad soldering events, so it’s a good thing I was just a bit untidy and didn’t have any real disasters.

Programming the Arduino is done in a simplified version of C++, based on the Wiring platform, with some of the structure of your program pre-defined and hidden from you to make it easy to get started. It has its own IDE, originally developed for the Processing language. Arduino programs are called sketches, and they control the behaviour of the pins around the edge of the board, which you connect other components to (such as the shields, or standard electronic components).

Personally the first thing I did was look for a plugin that would allow me to work in Visual Studio rather than the Arduino IDE, and luckily there is one. Despite the claim that “serial tools are far better than Arduino”, I did find myself dropping back to the Arduino IDE on occasion for the tool that observes the serial output from the Arduino, as some of the output wasn’t appearing in the Visual Studio version, even though I knew it was there. Also some of the UI idioms it uses weren’t entirely at home in Visual Studio – adding a new Project from the Project menu, rather than the File menu for example. Apart from those quibbles though, the Visual Micro plugin gave me an environment I was happier working in.

The Voice Box shield turned out to be simple to program to. Using standard Arduino library functionality, you create a software serial port that will use two pins to talk directly to the SpeakJet chip on the Voice Box shield; then you send arrays of numerical commands to that serial port. That’s it, as far as technical stuff goes.

Where the work arises is in figuring out what those numerical commands should be. There are some general commands for such things as volume, speed, and pitch, and then more specific commands that represent phonemes that can be used to build up your speech.

There is a helpful program that will do some of this work for you, based on a dictionary of words that other people have already created. If the dictionary doesn’t contain the words you want, however, you’ll have to build them up one phoneme at a time. This applies to perfectly normal words that you’d expect everyone would want an electronic voice to say for them, such as “Exterminate!”, so get ready to spend some time looking up numerical codes for phonemes.

I spent less time with the EasyVR voice recognition shield, so don’t have a lot to say about it at the moment, except that it maintains tables of words it can recognise and the pre-defined words worked perfectly well for me. I haven’t yet investigated customising it, but working within the limitations of this and the Voice Box, I hope it’ll be possible to build up simple dialog trees.

I got the Ardumoto shield to drive the motors on a Dagu Magician chassis. They appear to be a bit weedy, so I don't think they're going to drive that Sevan's Dalek I have lying about, even though it looks like the Magician chassis would fit beneath the skirt, but it’s a start.

So if everything works, why haven’t I achieved more? Well, you may have guessed, but everything working fine separately is not the same as everything working in unison. Although there are quite a lot of pins controlled by the Arduino (6 analogue and 14 digital), inevitably some of the shields want to use the same pins for different purposes. The next step is to do something about this, to which end I’m looking at the Go Between shield from Mayhew Labs; and if in future I want to add many other components so that a robot can interact with the outside world, I will probably end up looking at a Mux Shield.

In future, I might like to play with a Netduino in order to get a nicer programming environment, but I started off with an Arduino because it’s more widely used and supported and I wasn’t going to be faced with the possibility of having to write my own support libraries for shields before I really knew what I was doing.

I’ve had a bit of fun, it’s not been too taxing of my electronics or programming skills, and it looks like more interesting things could be fairly easily achievable.

Comments

Posted by: visualmicro (visualmicro)
Posted at: June 1st, 2012 09:05 pm (UTC)
Arduino for Visual Studio Team - Request Feedback

Despite the claim that “serial tools are far better than Arduino”, I did find myself dropping back to the Arduino IDE on occasion for the tool that observes the serial output from the Arduino, as some of the output wasn’t appearing in the Visual Studio version, even though I knew it was there. Also some of the UI idioms it uses weren’t entirely at home in Visual Studio – adding a new Project from the Project menu

Hi, I am on the Arduino for Visual Studio IDE team and very pleased to hear you found the free plugin useful. Whilst I appreciate the two points you have mentioned above are not critical they are not as intended. The serial output should show everything that the Arduino IDE shows and you should also have menu items on the file menu for "Open Arduino Project" and "New Arduino Project". Right clicking the solution node of the solution explorer in Visual Studio should also show the options. We would love to address these issues where applicable so, when you find time, please contact us via http://www.visualmicro.com or via @visualmicro on twitter.

Finally, we have an integrated Visual Studio Arduino debugger due for release shortly that will work over any protocol such as serial so should be quite useful for some people. We would love to have you as a beta tester or after release for you to review the debug tool. If you are interested then there are a few (early draft) documents about the arduino debugger here

Thanks for the mention, best of luck with your great projects. Hope to hear from you soon

1 Read Comments