Instructables Arduino competition

I was actually stuck in a bit of a tricky situation deciding whether to spread the word about this cool competition. You see, if I didn’t spread the word I would have had more chance at winning as there would be less entries. But, that would make me feel kind of bad for not telling you guys about cool stuff. So I decided to tell you about it and hopefully get some more people into this stuff with the incentive of a big, juicy DSLR.

So, on to the competition details. There is a DSLR, kindle fire and an Arduino mega on offer as prizes. And it’s open to Australians! How is that even possible? Tech competitions are never open to us…. I’m very confused. Anyway, there’s not that many entries (yet) so I think it’s a good idea to make a project quickly so it can get the early votes before it gets lost in the pages of projects. I would tell you some of my ideas but I’m not that generous.

Check the competition out here: http://www.instructables.com/contest/arduino2012/?show=INFO

Making the tape-player synthesizer a permanent project.

A few days my mum gave me an utimatum. If I didn’t clean my room I wouldn’t be paid for washing the house’s windows. I needed to wash the windows to raise money for my 3D printer. At this point you’re probaby asking why I needed to clean my room. The header for this blog has a perfectly clean bedroom desk in it. Well, you haven’t seen the floor. So I cleaned it up. And I found buried under a small mountain of old DVD drives my old tape-player synthesizer. Don’t remember my tape-player synth? Here’s the link to my last post about it.

So I opened it up. And it was a mess. There was a breadboard clinging on with a few scraps of blu-tac and the etherten board was long gone (sabotaged for another project). There were loose wires everywhere. Looked like it was time to do this thing properly. Because, you know, retro synths are cool to have around …

I opened up fritzing (the free electronics circuit designer) on my laptop and got to work laying out a controller circuit on some stipboard. To avoid having to do any major code changes I simply used the atmega328 chip from an arduino. This meant that to reprogram the board all I had to do is program it in the uno board then remove it and place it in my board. The part count for running an atmega328 without the arduino board is quite low. You only need a crystal, 2 capacitors and a resistor. So it’s very easy to design a DIY stripboard version of an arduino. Here’s the link to the circuit for using an atmega328 without the arduino board: http://arduino.cc/en/Tutorial/ArduinoToBreadboard . I just converted the layout to copper strip board.

My layout was fairly simple. It included:

  • An atmega328 microprocessor.
  • 2 18pf capacitors
  • 1 10k resistor
  • 16mhz crystal
  • A header for breaking out the 5V, TX, RX, GND and RESET pins of the atmega328. So you can program it without having to remove the chip if you don’t want to.
  • A few jumper wires

And that was all. Including designing, test fitting, board cutting, laying out components and soldering it wouldn’t have taken more than an hour. Very easy to do. Here’s a pic of the finished board.

And here’s a fritzing diagram.

Ignore the speakers and pots for now. We'll talk about those later.

Now the controller board is done we can solder it up to the synth controls and give it a go. The output of the synth program is on digital pin 9 (PWM) and the input pins are analog pins 1-5. Simple. Each pot has to be wired to 5V,GND and it’s analog pin. Which isn’t particularly difficult, just arduous. The speaker is wired to digital pin 9 and GND. For the output I didn’t have an audio jack handy so I ended up just using alligator clip wires connected to nice logitech speakers. Which provided plenty of output volume because the logitech speakers have an amplifier built in  (I think). Here’s a pic of the finished electronics:

I know the wiring is messy... I didn't have enough to make it neat again.

I know the wiring is messy... I didn't have enough wire to make it neat again.

So there you have it. I wired up an old USB cable for power so I can use it wherever I want and that’s about it. Here’s the final version of the code:

int note = 100;
int beat = 50;
int length = 10;
int pin = 9;
int note2;
int note3;
int button1;
int button2;
int effect;
void setup() {
pinMode(13, OUTPUT);
pinMode(pin, OUTPUT);
pinMode(2,INPUT);
pinMode(3,INPUT);
Serial.begin(9600);
}

void loop() {
length= analogRead(1)/10;
beat= analogRead(2)/10;
note= analogRead(3)/5;
note2= analogRead(4)/5;
note3= analogRead(5)/5;
tone(pin,note);
delay(length);
noTone(pin);
delay(beat);
tone(pin,note2);
delay(length);
noTone(pin);
delay(beat);
tone(pin,note3);
delay(length);
noTone(pin);
delay(beat);
}

Oh, and of course I couldn’t leave you without a long video displaying how horrible it sounds…..

Arduino 1.0- the good and the bad

Arduino 1.0 was released (relatively) recently and having had the chance to do some coding with it I’ll share some impressions.

The first time I used 1.0 didn’t go too well. I was showing my school electronics teacher how to program arduinos and it wouldn’t load a duemilanove board with a Blink sketch. This was with a freshly downloaded hot off the press 1.0. I tried the usual wrong board or comport but that wouldn’t fix the problem. It had me stumped. This had never happened before to me. This was on a Dell computer running Windows XP. However, when I got home I loaded up 1.0 on my computer and it worked fine. I think there may have been some issues with the early release files. After a while his worked fine as well. So it must have just been a one-off.

Let’s now look at the good and the bad of the new IDE having used it for a few weeks. This is not from some article which tells you what the new code features are or anything like that. This is just the stuff that I’ve noticed while using it and thought “that’s nice”. Or, why hasn’t that been fixed yet.

The good

Awesome new load screen with a nicely designed logo. Much better than the old one. But it doesn’t make it load any faster.

I like the loopy love heart thingys......

I like the loopy love heart thingys.....

New icons make it look much sleeker than the old version. This provides a better and cleaner experience. Having the upload button next to the Verify button should also makes things a bit easier for beginners. Not that I ever really use the verify button anyway. I mean, your code is automatically verified before it is uploaded so what’s the point?

Progress bar! This surely has to be the best improvement of all! No more staring at the little black console window to see whether it is actually going to load your code or not.

It does seem to be quite jumpy however...

It does seem to be quite jumpy however...

Another very useful feature is the line of text in the lower right hand corner ofthe window telling you what board and serial port you have selected. It is nice to know what these are as these are the settings you change the most. It’s also means you don’t have to use the super slow Java menus.

It also tells you what line of code you're on... but the old one did that as well...

It also tells you what line of code you're on... but the old one did that as well...

The blue colour scheme is slightly lighter…. doesn’t really affect functionality but I thought I would mention it anyway.

The bad

Java. I’m told it’s what makes the whole thing super slow. Arduino is a massive international open source project. Surely we can make something together that can load a menu bar in under 5 seconds. I have never used a windows app that is so slow.

It’s killed off quite a bit of old code. Things like LCD CreateChar sketches required some modification. I’ve heard it’s rendered some other things useless as well. I guess it’s all in the way of progress….

There’s not much more I can complain about. It’s pretty darn good for something that is free….

 

Arduino saving helper

I’ve made a new years resolution already. I know it’s a little early but I don’t really see the point in waiting till the new year to commit to something. My new years resolution is to buy a PrintrBot- the $500 DIY 3D printer. See here for more on them: http://printrbot.com/ .

Awesome.

Awesome.

Now I’m not one of those people who can pull $500 out from the back of their couch so I’m going to have to save up for this thing. And with the school holidays beginning in a week now is the perfect time to be planning to make money. Christmas means that parents want windows washed, aunts want cars cleaned and everyone wants everything to look good. They’re willing to pay and I’m free to work as much as I like. Perfect combination.

So I’ve got a great goal and time to work for it. But something is missing. Just counting up the money on a sheet of paper lacks a certain cool factor. No, I need to do something geeky to count the money that is going towards my geeky goal. Like an Arduino money-saving helper. I know the name sounds a bit ridiculous.

The concept is pretty simple. Have a device that sits on my desk that constantly reminds me how much money I have saved. This will hopefully get me off my bum and doing some work instead of surfing the internet for the whole holidays. I had a spare LCD lying around so I decided to use that for the display bit. And as you already know, I used the trusty old Arduino platform for the computer processing.

Getting an LCD going with the Arduino is quite easy thanks to an official library included with the IDE. Here’s the official reference page for the library: http://www.arduino.cc/en/Reference/LiquidCrystal . The library is compatible with most off the shelf 16×2 LCDs and can be used in both 4-bit and 8-bit modes. Here’s a more in depth step by step tutorial by the awesome ladyada if you’re confused: http://www.ladyada.net/learn/lcd/charlcd.html . Don’t worry if your LCD starts spitting out random chinese characters like mine does occasionally. That just means that it is receiving the wrong instructions – usually just a loose data wire.

The next part to the money counter saving thingy is some input for adjusting the money saved. This is easily achieved using two simple switches and some resistors connected to arduino inputs. I used the pull-up resistor method for my switches. See here for more: http://www.ladyada.net/learn/arduino/lesson5.html . One switch adds money, one switch subtracts. Simple.

So we now have the 3 basic elements- arduino, LCD, and some input. The only thing left to do is to shake a little bit of programming magic over the whole thing. Now I’m not quite done with this yet for one reason – EEPROM.

What is EEPROM you ask? The EEPROM memory bit of the atmega328 arduino core chip is a bit like the hard drive in your computer. It stores things even when power is disconnected. It doesn’t disappear when the arduino is unplugged like standard variables stored in the RAM. So it’s very useful. It means you can do datalogging and other things that require memory without having to resort to fancy SD card shields. Sounds like this thing is the go for my little money thing. It does however have a downside. It is only rated for 100,000 read or write cycles. That doesn’t sound like a problem at first but an arduino can chew through that pretty fast. So it’s important to be careful about how much we use this special little EEPROM’s bits and bytes. However that’s not really an issue as I can just write to the memory whenever the figure changes. And I’m not planning on raising over 100,000 dollars. And before you Hackaday readers out there kick up a stink I know a guy proved that the EEPROM can last for a lot longer: http://hackaday.com/2011/05/16/destroying-an-arduinos-eeprom/ .

So this is where the problem is. My little EEPROM memory is a bit erratic. I think I may have burnt it out a while ago or something. Hmmmmmm. I might use a backup battery and have a low power mode instead. This is what I’ve still got left to do:

  1. Fix memory issue.
  2. Add some more to the LCD program to make it a bit more interesting. Things like percentages and bar graphs.
  3. Implement servo control so I can have a little saving dial.
  4. Earn some money.

So that’s what I’m up to so far. Here’s a photo:

The backlight works it's just that the camera was blinded by it.

The backlight works it's just that the camera was blinded by it. Oh yeah, and that is the actual amount saved so far.

Well, I’ll keep you posted as always.

 

Chipkit Uno 32 Review

The Arduino electronics prototyping platform is one of the most successful electronics hobbyist products in the world. It has introduced thousands of ordinary people to digital electronics and is probably the most famous open source hardware project ever. One of the reasons it is so popular is it’s simplicity. It does without things like 32 bit computing and fancy features and sticks to a simple, small 8 bit processor. For most hobbyist’s electronics projects an Arduino Uno board will give all the computing power they could ever need. However, there are some projects that require a bit more grunt or some more pins without having to splash large amounts of cash on an Arduino Mega. Like building a servo humanoid robot for example. Or a 3D printer, or some big LED display. Then the Arduino hobbyist is faced with a problem. They can buy an expensive Arduino Mega with more power or try and learn a whole new platform like the PIC32. Both of those options can be daunting and expensive. Enter the chipKit line of Arduino compatible development boards for the PIC32.

There are two versions of the chipKit development boards much like the arduino boards. There’s the chipKit Uno32 and the chipKit Mega 32. The chipKit Uno32 is the lower end board and lacks some of the features of the chipKit Mega 32 like Ethernet, USB and 83 I/O pins. However, the chipKit Uno is a very powerful board anyway. It has:

  • 42 I/O pins
  • 80 Mhz 32 bit processing power
  • 128K of Flash and 16K of SRAM
  • Arduino form factor and compatibility

Out of the box

I received my chipKit Uno32 board from element 14  Australia about a week ago. The chipKit Uno 32 comes in a box very similar to the one the official Arduino Uno comes in. A nice addition is some anti static foam for the board to rest on so it isn’t fried during it’s journey to your front door. I’m not exactly sure how that would happen but it’s a nice touch nonetheless. The Arduino Uno board doesn’t come with this foam. However, the chipKit Uno 32 packaging lacks a nice booklet like the one the Arduino Uno comes with.

First impressions are that this thing is pretty cool. It has a LOT of input and output pins-  42 in total. It looks very similar to the Freetronics Etherten with the flat chip and mini USB connector. Everything is laid out carefully in the same layout as the Arduino Uno so there is no need to worry about shield compatibility (apart from the 3.3V issue, more on that later).

At the core of the development board is PIC32MX320F128 processor. Now this is where the two chipKit boards differ. The chipKit Mega 32 has a PIC32MX795F512 processor which has advanced communications capabilities such as USB, Ethernet and a high number of I/O built in. The chipKit Uno’s PIC32MX320F128 processor does not have these features built in. It is still a powerful processor with 128K of flash and 16K of SRAM. Here’s a comparison between the chipKit Uno32 and the Arduino Uno:

chipKit Uno32 (Microchip 32 bit PIC32MX320F128) vs Arduino Uno (AVR 8 bit ATMega328):

  • Flash: 128K vs 32KB
  • SRAM: 16K vs 2KB
  • I/O: 42 vs 14
  • Speed: 80Mhz vs 16Mhz
  • Operating voltage: 3.3V vs 5V

So I think it’s pretty clear to see that this thing is a powerhouse out of the box compared to the official Arduino Uno. And it even runs at a lower voltage than the standard Arduino Uno. Let’s look at what it takes to get a blink sketch up and running.

Getting off the ground

To get started with a chipKit Uno32 you’ll need to download a special modified Arduino IDE from here: https://github.com/chipKIT32/chipKIT32-MAX/downloads . I downloaded the 3rd one down – the windows zip package. I’m pretty sure that the chipKit board does not work with the official Arduino IDE as I tried to program it straight up with that and it didn’t work.

Once you have the modified IDE downloaded and extracted you can start the MPIDE. You’re presented with what looks like the normal Arduino IDE with a message in the splash box saying it’s a modified version. Have a look at the boards menu though. It has a multitude of other PIC32 boards along with the standard arduino boards.

I loaded the blink sketch from the examples in mpide no problems. Don’t forget to select the UNO32 board from the menu. Hit the upload button and the pin 13 LED flashes just like on a standard Arduino.

So setting up the chipKit Uno32 is just as easy as setting up an Arduino Uno. Let’s do a speed comparison between the two.

Speed test!

The main differences between the chipKit Uno32 and a standard Arduino Uno are the amount of I/O pins and the computing speed. It’s pretty obvious the difference in pins so I decided to do a computing test.

I used serial to do a basic speed comparison between the chipKit Uno32 and an Arduino Duemilanove. My Arduino Uno wasn’t working so I couldn’t test it with that. However, the Arduino Uno and Duemilanove are very similar in computing power. I wrote this simple program to count to a million and report how long it took by printing out the time in milliseconds to the serial monitor. Once it has printed out the time it has taken in milliseconds it prints it out every 5 seconds as a sort of test to see whether the value was true. Here’s the code:

void setup() {
  Serial.begin(9600);
}
unsigned long number;
int time;
void loop(){
number++;
if(number > 1000000){
time = millis();
Serial.println(time);
delay(5000);
}
}

The chipKit Uno32 achieved a time of 250 milliseconds every time.

A stock standard Arduino Duemilanove achieved a time of  2263 milliseconds every time.

Ouch. That’s quite a big difference if your Arduino sketches commonly include large calculations.

Some features

The chipKit Uno32 has some nifty little features built in. Here’s some of the cool ones:

  • Mini USB connector. Just like an etherten’s so it doesn’t short against shields. A criticism of the Arduino boards that hasn’t been addressed.
  • Open source. Always a cool thing. Get the schematics and everything else you could ever need here:http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,892,893&Prod=CHIPKIT-UNO32
  • 2 User LEDs. On pin 13 and 43. They are placed on the outer edge of the board so they can still be clearly seen when a shield is plugged in. There’s 2 of them so you can have twice the super fast trippy blinking LED fun than before. What, isn’t that what you did when you first got an Arduino?
  • Lots of input and output pins. 42 in fact. 12 analog pins. Enough to drive just about enough LEDs for any christmas project.
  • 32 bits and 80 Mhz of grunt.
  • ICSP PIC programming header holes. If you own a PICkit 3 you can use that to program it.
  • Heaps of program space. So you can program in all the Christmas tree animations you could ever imagine.

So those are the good bits. Here’s the bad stuff:

  • The chip can’t be removed. Unless you’re a Jedi at soldering. This means you can’t program the chip like with the Arduino Uno and then put it in a socket on your custom project circuit board.
  • No AVR ICSP programming header. So you can’t program this with an AVR ICSP.
  • 3.3V operating voltage means that some shields won’t work. Most should though.
  • There’s no atmega8u2 chip like in the Arduino Uno. No emulating HID USB devices (keyboards, mice etc) for you. Not that anyone seems to have figured out how to do that anyway….
  • I think there’s some code that doesn’t work. For example, I was going to use some of the Arduino Test Suite code on the board and it didn’t work. See here for more on the issue of code compatibility: http://www.chipkit.cc/wiki/index.php?title=ChipKIT%E2%84%A2_Support_Resources#chipKIT.E2.84.A2_Development_Environment.2C_functions_and_libraries

But that’s about all that’s wrong with it. It’s a great board for those who love the Arduino concept but need something a bit more powerful. It’s easy to get started with and is extremely powerful (especially the Mega model). It’s probably not the best choice if you’re just starting out in Arduino though. It’s definitely the way to go if you want some more grunt in your Arduino projects. I highly recommend it. Pick one up now at element 14 for $35.

Also have a look at some of their other digilent boards while you’re there.

 

 

 

Youtube space lab and ebay electronics.

Let’s start with spacelab.

Spacelab is a project being run by YouTube (really by Google then) to encourage scientific thinking in education. It’s basically a big competition to come up with the best experiment to be done in space. If you win the international competition your project is put 250 miles above the earth. If you win the regional competition you get a computer and a zero-G flight. This is pretty cool stuff and I’m pretty sure it’s been done before. Anyway, before I talk about it more have a look at this video to get a rough idea of how cool this thing is.

Okay so it’s a pretty cool idea. But it’s going to be a very difficult thing to win (not that I might enter or anything). Here’s a couple of reasons as to why:

  1. It’s extremely popular. The main promo video embedded above has over 2 million views at the time of writing. That’s a lot of kids.
  2. This thing is the sort of thing that can define someone’s career. Imagine going to the university interview. Now what have you done at school? Oh, I only designed an experiment that was launched by NASA. You’re in to MIT or any other cool university instantly.
  3. The challenge of coming up with a good idea is huge. There are people at NASA whose entire job it is to come up with experiments. Weight costs a lot on rockets and they try not to waste any of it. So a lot of the obvious good ideas have already been done. That’s probably why they made this competition up to get some new ones. You’ll have to look pretty hard for something interesting to do.

To find out more about this whole thing visit the website at http://www.youtube.com/user/spacelab . They have a great little app that simulates a rocket taking off from your location which leads into the main highly interactive site.

Moving onto more boring and more down to earth things, (that is if you’ve come back to this site after having spent half an hour on the spacelab one like I did) I got some new ebay electronics today. I thought I’d show you a few photos from the unboxing of this gear: http://www.ebay.com/itm/Arduino-DIY-Starter-Kit-lcd-Relay-Stepper-Infrared-1602-/160665168054?pt=LH_DefaultDomain_0&hash=item256863e8b6

The box I'm putting this stuff in. i'm going to try and keep this stuff a bit more organised than my last lot of ebay electronics.

The box I'm putting the new electronics in. i'm going to try and keep this stuff a bit more organised than my last lot of ebay electronics.

The box it came in. I wish I'd continued to learn chinese.

The box it came in. I wish I'd continued to learn chinese.

Oh yeah and take note here all ye who unbox things online. Notice how I didn’t show my adress. It’s kind of essential for not getting cyber stalked.

This looks promising.....

This looks promising.....

Crappy breadboard. Useful for keeping stuff you want to modify in future.

A crappy breadboard. Useful for keeping stuff you want to modify in future.

An LCD. So we meet again Mr LCD. Look for a post I wrote a while ago to get what I mean.

An LCD. So we meet again Mr LCD. Look for a post I wrote a while ago about a certain LCD soldering experience to get what I mean.

Um yeah, a lot more wires. I really don't need any more.

Um yeah, a lot more wires. I really don't need any more. But thanks anyway.

I don't think I'm going to be short of resistors for quite some time.

I don't think I'm going to be short of resistors for quite some time. Or any other little parts.

A 9V battery lead. Very useful.

A 9V battery lead. Very useful.

Relays, 7-segment displays and some driver chips. Useful for room automation stuff.

Relays, 7-segment displays and some driver chips. Useful for room automation stuff.

The stepper motor. These take a lot more external circuitry to drive than I expected.

The stepper motor. These take a lot more external circuitry to drive than I expected.

Headers and an IR remote. Both are really useful.

Headers and an IR remote. Both are really useful.

A 10K potentiometer that actually fits in a breadboard.

A 10K potentiometer that actually fits in a breadboard for once.

Enough padding to make a fake jumping castle in your backyard. In my experience, ebay shops are more careful with shipping than non ebay shops (sparkfun etc).

Enough padding to make a fake jumping castle in your backyard. In my experience, ebay shops are more careful with shipping than non ebay shops (sparkfun etc).

All the major components that came with this have were tested and worked fine (i.e. the LCD, stepper motor and the number display as well as the driver chips). The LCD has a really nice backlight and the blue LEDs that came with the kit are really bright. However, I did notice one wrong part. The RB LEDs that were meant to come with the kit were actually RG LEDs

I don't think I'm going to be short of resistors for quite some time.

I don't think I'm going to be short of resistors for quite some time.

The whole kit was well packed and came pretty quickly (under 2 weeks) You can’t really complain when you get this many components for only $40. But the breadboard that came with the kit is pretty annoying.

I might write a blog post about my new iSpy security camera setup sometime. It’s pretty cool.