Saturday, January 28, 2012

Review – Digilent chipKIT Uno32

In this review we consider a Digilent chipKIT Uno32 development board made available by element-14.

Introduction

This is a development board that is based on the Arduino Uno, however uses a Microchip PIC32MX320F128 microcontroller instead of the Atmel ATmega328 we are used to:

Digilent’s decision to use the PIC32 introduces some interesting changes to the Uno format, and the largest change to take note of is the clock speed – 80 MHz instead of the Uno’s 16 MHz. That certainly took my attention, and we can see this demonstrated shortly.

When shipped the board arrives alone in a cardboard box, without a USB cable:

All documentation is found on the Digilent website. There is also a support forum to discuss libraries, IDE updates and so on. The board itself is quite familiar upon initial inspection:

You can see that Arduino shield will physically fit onto the board, and the extra I/O pins are accessed through the second rows of jumpers inside the board. With some crafty PCB creation skills you could make your own Uno32 shields, or consider one of the boards available from element-14 or Digilent.

As for the other specifications of the Uno32:

  • Clock speed – 80 MHz
  • 128K flash program memory
  • 16K SRAM data memory
  • I/O pins – 42 (12 used as analogue inputs or digital I/O)
  • Five PWM pins
  • FTDI chip for USB interface
  • Two user LEDs
  • Same form factor as Arduino Uno boards, which allows physical shield compatibility
  • Five interrupt pins
  • On board real-time clock (external crystal required)

You will need a new IDE, and you can download Uno32-modified versions of the Arduino v22 and v23 IDE from here for Windows, MacOS and 32-bit Linux (no 64-bit…). The bootloader is preinstalled on the Uno32 and after installing the special IDE it works just as our normal Arduinos do in terms of editing and uploading sketches. The board also is compatible with the Microchip MPLAB IDE and PICkit3 in-circuit debugger if you want to use the Uno32 as a normal PIC32 development board. There is a row of holes between the USB socket and the DC socket that will need header pins soldered in for PICkit3 use.

Speed comparison

Naturally you want to see the speed test. The following sketch was run on an Arduino Uno and the Uno32 boards using IDE v1.0 for the Uno and the MPIDE v23 for the Uno32:

void setup() { Serial.begin(9600); }
unsigned long a,b,c,d,e;
void loop() { a=millis(); for (c=1; c<1000000; c++) { d=sq(c); } b=millis(); e=b-a; Serial.print("Duration: "); Serial.print(e); Serial.println("ms"); do {} while (1>0); }

And here are the results of running the sketch four times on each board (click image to enlarge):

Well that’s pretty impressive – over sixty times faster than the Arduino Uno. Therein lies the major reason to use this board over the Uno. The eagle-eyed among you may have also noticed the difference in the compiled binary sketch size – 6432 bytes for the Uno32 vs. 2540 bytes for the Arduino Uno. That’s interesting.

Nevertheless there are many things to take note of when moving from Arduino to Uno32, or in other words – you can’t just swap out an Arduino Uno for an Uno32, recompile and run your sketch at the faster speed. The Microchip PIC32 is very much a different beast to the Atmel AVRs we’re used to, so it is important that you understand the differences in hardware and software to take advantage of the Uno32. So let’s run through those  now.

Power Differences

The Uno32 is a 3.3V board due to the PIC32. You can still power it via USB, or connect between 7~15 VDC to the power socket on the board. You can change a jumper and feed 5V directly into the board bypassing the 5V regulator. External power is regulated to 5V then to 3.3V. From a total of 1A current, the PIC32 uses 75mA, so you can draw up to 925mA from the 5V bus or 425mA from the 3.3V bus (or a mixture from both). It would pay to determine your current load before testing to avoid damaging the board, however  the  manual notes that the regulators will become hot at high current loads but do have thermal protection. Finally there is also a jumper that chooses between a 5V or 3.3V voltage feed to the shields. As always, consult themanual first.

I/O Differences

Although the PIC32 being a 3.3V part, the manual states that the digital I/O pins are 5V tolerant, so applying 5V to a digital input won’t damage the PIC32. Logic on the other hand is a different kettle of fish. According to the manual a digital ‘high’ when sourcing 12mA of current will only reach close to 3.3V. This may be too low in some situations so check your threshold voltages when choosing external parts. Furthermore, the analogue reference voltage (AREF) is restricted to 3.3V.

One stand-out difference is that you can only source 18mA from a digital pin, which is OK if you’re blinking some LEDs. However for logic output to keep the voltage range below 0.4V for ‘low’ and above 2.4V for ‘high’ the current must be restricted to -12~+7mA – another different limitaion. Finally, the maximum current you can source over all the I/O pins at once is 200mA.

There are two UARTs, number one where we expect it (D0/D1) and another on pins 39 and 40. I2C is on A4/A5 but needs to be activated with a jumper. Note that unlike an Arduino there aren’t any inbuilt pull-up resistors for the I2C bus, so add your own. There is also an SPI bus at the usual position (D10~13) and interestingly you can change the board between SPI master and slave via another set of jumpers. There are five pulse-width modulation outputs, however one is on D10 which is also part of the SPI bus. Finally there are five hardware interrupt pins.

Question – What type of processor core does the PIC32 use?

Shield Compatibility

Arduino shields will physically fit onto the Uno32 – but you need to be aware of the I/O differences listed above, the voltage and current specification and also the software side of things. Again – do your research before making the commitment to the hardware.

Software Compatibility

The Uno32 is compatible with a variety of Arduino sketches, but not all. This in a large part is due to the libraries which will need to be sourced from the community or rewritten yourself if not provided with the MPIDE software. There is a community on the support forum which is contributing their own, such as the real-time clock library – but again, research needs to be done before use. When trying to use an existing Arduino sketch and hardware, you will need to spend some time checking for compatibility. Again – it’s much easier to design a new project around the Uno32 than rejig an existing one.

Open Source? 

One of the things many people love about the Arduino ecosystem is that the entire system is open source hardware and software. Without causing a pro/con argument about software licensing you should note that not all of the software toolchain for the Uno32 is open, nor the USB or TCP/IP stack. There is some interesting discourse about this here.

Conclusion

A lot of work needs to be done to ensure compatibility with existing Arduino applications. The Uno32 is tempting due to the raw clock-speed increase, however the sketch/library and hardware differences may introduce a few road blocks. However, when designing a project from scratch and understand the licensing limitations, the Uno32 would be great as you know what you have to work with – a much faster board with much more I/O. And it is very inexpensive, less than ~$35.

Finally, if you’re looking for a very inexpensive PIC32 development board to use with Microchip MPLAB, the Uno32 is a great deal that can possibly interface with a wide variety of shields from the Arduino world.

Disclaimer – The Chipkit Uno32 board reviewed in this article was a promotional consideration made available by element-14.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Monday, January 23, 2012

Arduino meets Las Vegas with the Freetronics DMD

Hello Readers

Time once more to have some fun, and this time by examining the new Freetronics DMD “Dot Matrix Display”. We will look at the setup and operation of the display. In a nutshell the DMD comprises of a board measuring approximately 320mm across by 160mm which contains 16 rows of 32 high-intensity red LEDs. For example, in the off state:

Connection of the DMD to your Arduino-compatible board is quite simple. Included with each DMD is a 2×8 IDC cable of around 220mm in length, and a PCB to allow direct connection to the Arduino digital pins D6~13:

Finally the cable connects to the left-hand socket on the rear of the DMD:

You can also daisy-chain more than one display, so a matching output socket is also provided. Finally, an external power supply is recommended in order to drive the LEDs as maximum brightness – 5V at ~2.8 A per DMD. This is connected to a seperate terminal on the rear of the board:

Do not connect these terminals to the 5V/GND of your Arduino board!

A power cable with lugs is also included so you can daisy chain the high-intensity power feeds as well. When using this method, ensure your power supply can deliver 5V at 2.8A  for each DMD used – so for two DMDs, you will need 5A, etc. For testing (and our demonstration) purposes you can simply connect the DMD to your Arduino via the IDC cable, however the LEDs will not light at their full potential.

Using the display with your Arduino sketches is quite simple. There is an enthusiastic group of people working on the library which you will need, and you can download it from and follow the progress at the DMD Github page and forks. Furthermore, there is always the Freetronics forum for help, advice and conversation. Finally you will also need the TimerOne library – available from here.

However for now let’s run through the use of the DMD and get things moving. We will be using Arduino IDE v23. Starting with scrolling text – download the demonstration sketch from here. All the code in the sketch outside of void loop() is necessary. Replace the text within the quotes with what you would like to scroll across the display, and enter the number of characters (including spaces) in the next parameter. Finally, if you have more than one display change the 1 to your number of displays in #define DISPLAYS_ACROSS 1.

Here is a quick video of our example sketch:

Now for some more static display functions – starting with clearing the display. You can use

dmd.clearScreen( true );

to turn off all the pixels, or

dmd.clearScreen( true );

to turn on all the pixels.

Note: turning on more pixels at once increases the current draw. Always keep this in mind and measure with an ammeter if unsure. 

Question – How many LEDs are contained in the Freetronics DMD?

Next some text. First you need to choose the font, at the time of writing there were two to choose from. Use

dmd.selectFont(System5x7);

for a smaller font or

dmd.selectFont(Arial_Black_16);

for a larger font. To position a single character on the DMD, use:

dmd.drawChar(  x,  y, 'x', GRAPHICS_NORMAL );

which will display the character ‘x’ at location x,y (in pixels – starting from zero). For example, using

dmd.drawChar(  10,  5, 'A', GRAPHICS_NORMAL );

results with:

Note if you have the pixels on ‘behind’ the character, the unused pixels in the character are not ‘transparent’. For example:

However if you change the last parameter to GRAPHICS_NOR, the unused pixels will become ‘transparent’. For example:

You can also use the parameter GRAPHICS_OR to overlay a character on the display. This is done with the blinking colon in the example sketch provided with the library.

Next, to draw a string (group of characters). This is simple, just select your font type and then use (for example):

dmd.drawString( 0,0, "Hello,", 5, GRAPHICS_NORMAL ); dmd.drawString( 2,9, "world,", 5, GRAPHICS_NORMAL );

Again, the 5 is a parameter for the length of the string to display. This results in the following:

Next up we look at the graphic commands. To control an individual pixel, use

dmd.writePixel(  x,y, GRAPHICS_NORMAL,1); // turn on a pixel at location x,y

And changing the 1 to a 0 turns off the pixel. To draw a circle with the centre at x,y and a radius r, use

   dmd.drawCircle( x,  y,  r, GRAPHICS_NORMAL );

To draw a line from x1, y2 to x2, y2, use:

   dmd.drawLine(  x1, y1, x2, y2, GRAPHICS_NORMAL );

To draw a rectangle from x1, y2 to x2, y, use:

dmd.drawBox(x1, y1, x2, y2, GRAPHICS_NORMAL );

And to draw a filled rectangle use:

dmd.drawFilledBox(x1, y1, x2, y2, GRAPHICS_NORMAL );

Now let’s put those functions to work. You can download the demonstration sketch from here, and watch the following results:

So there you have it, an inexpensive and easy to use display board with all sorts of applications. Although the demonstrations contained within this article were rather simple, you now have the knowledge to apply your imagination to the DMD and display what you like. For more information, support and conversation visit the Freetronics product page and support forum.

Disclaimer – The parts reviewed in this article are a promotional consideration made available by Freetronics.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Tuesday, January 17, 2012

Review: Mayhew Labs “Go Between” Arduino Shield

Hello readers

In this article we examine one of those products that are really simple yet can solve some really annoying problems. It is the “Go Between” Arduino shield from Mayhew Labs. What does the GBS do? You use it to solve a common problem that some prolific Arduino users can often face – how do I use two shields that require the same pins?

Using a clever matrix of solder pads, you can change the wiring between the analogue and digital pins. For example, here is the bare shield:

Now for an example problem. You have two shields that need access to digital pins 3, 4 and 5 as also analogue pins 4 and 5. We call one shield the “top shield” which will sit above the GBS, and the second shield the “bottom” shield which will sit between the Arduino and the GBS. To solve the problem we will redirect the top shield’s D3~5 to D6~8, and A4~5 to A0~1.

To redirect a pin (for example D3 to D6), we first locate the number along the “top digital pins” horizontal of the matrix (3). Then find the destination “bottom” pin row (6). Finally, bridge that pad on the matrix with solder. Our D3 to D6 conversion is shown with the green dot in the following:

Now for the rest, diverting D4 and D5 to D7 and D8 respectively, as well as analogue pins 4 and 5 to 0 and 1:

The next task is to connect the rest of the non-redirected pins. For example, D13 to D13. We do this by again bridging the matching pads:

Finally the sketch needs to be rewritten to understand that the top shield now uses D6~8 and A0~1. And we’re done!

Try not to use too much solder, as you could accidentally bridge more pads than necessary. And you can always use some solder wick to remove the solder and reuse the shield again (and again…). Now the genius of the shield becomes more apparent.

The only downside to this shield is the PCB design – the days of square corners should be over now:

It is a small problem, but one nonetheless. Hopefully this is rectified in the next build run. Otherwise the “Go Between” Shield is a solution to a problem you may have one day, so perhaps keep one tucked away for “just in case”.

While we’re on the subject of Arduino shield pinouts, don’t forget to check out Jon Oxer’s shieldlist.org when researching your next Arduino shield – it is the largest and most comprehensive catalogue of submitted Arduino shields in existence.

[Note - the "Go Between" Shield was purchased by myself personally and reviewed without notifying the manufacturer or retailer]

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

Sunday, January 15, 2012

Initial Review: Akafuino-X Microcontroller Board

Hello Readers

Time to get back to work for 2012 and in doing so we review another interesting product from a new company based in Japan – akafugu. From their website:

Akafugu Corporation is a small electronics company that operates out of Tokyo, Japan. We specialize in fun and easy to use electronic gadgets. Our goal is to provide products that not only make prototyping faster and easier, but are also perfect for incorporation in finalized products.

And with this in mind we examine the Akafuino-X microcontroller board:

The observant among you will notice the similarity to our usual Arduino Uno and compatible boards. However there are some differences which bring changes and improvements over the original Arduino design. The biggest point of difference is the microcontroller, the Akafuino uses an Atmel XMega32A4. The benefit of this over the normal ATmega328 is:

  • Speed! 32 MHz – twice as fast as the ATmega328;
  • Two-channel DAC (digital to analogue) converter – output analogue signals between 0V and Vcc straight from the board. A library is included with the new IDE to control them. The DAC uses digital pins seven and eight;
  • Not one, two or even four, but five UARTs;
  • Two I2C buses;
  • Sixteen PWM pins – great for LED effects…

Thankfully the designers have detailed the extra I/O pins and other useful information on the rear of the board:

Other changes include:

  • It’s a 3.3V board – so no 5V supply for you. However the inputs are tolerant to 5V;
  • On-board real time clock. You can also add an optional 32.768 kHz crystal to increase accuracy – see the space on the board near the reset pin;
  • A very refreshing red colour (note that ‘aka(i)’ ** is red in Japanese) and a happy puffer fish (‘fugu’) on the silk-screening :)
  • And libraries for other Akafugu products such as the TWI Display module are available.

Getting started is easy, however due to the difference in hardware the Arduino IDE needs modification. But don’t panic – instead of modifying your existing v1.0 Arduino IDE – download and install the Akafuino-X version from here and run your usual and the Akauino-X IDE on the same machine (it’s ok to do this). You should also review the usage instructions here and note that this is a derivative of the v1.0 IDE. Furthermore at the time of writing the software side of things is still in beta, and can be monitored viaGithub - however don’t let this put you off, as the Akafuino-X has a lot of potential.

In the meanwhile we’ve conducted a quick speed test – by running the same sketch on an Arduino Uno and also the Akafuino-X. The test is a whole lot of multiplication, nothing too scientific. At the end the duration of the exercise is shown in milliseconds. Here’s the code:

// Arduino Uno test // void setup() { Serial.begin(9600); }
unsigned long a,b,c,d,e;
void loop() { a=millis(); for (c=1; c<1000000; c++) { d=sq(c); } b=millis(); e=b-a; Serial.print("Duration: "); Serial.print(e); Serial.println("ms"); do {} while (1>0); }

And here are the results of running the sketch four times on each board (click image to enlarge):

Our Akafuino-X beta only took 2704ms versus the Arduino Uno taking 4212ms. Very good so far.

So there you have it, another contender in the Arduino-compatible board stakes. Considering the extra  I/O, PWM and bus connectivity the Akafuino-X is a very capable board. I look forward to the evolution of the IDE and will return with the Akafuino-X in an upcoming project. And we also have one to give away. So stay tuned! In the meanwhile the Akafuino-X and other goodies are available directly from akafugu.jp

Disclaimer – The parts reviewed in this article are a promotional consideration made available by akafugu.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.

** Yes I know it’s an i-type adjective

Saturday, January 7, 2012

December 2011 Competition Results

Hello readers

Well December has well and truly passed on so it is time to announce the winners of our December 2011 competition. The lucky winner of the first prize, which consists of the eleven modules from the new Freetronics Module/Sensor range, as reviewed recently:

Is Stephanie F. from Melbourne, Australia. I hope you enjoy working with the new modules.

And the lucky winner of the second prize, the awesome and still the world’s best all-in-one Arduino Uno/ethernet/PoE/uSD card board solution – the Freetronics EtherTen:

Is Jaroslav F. from Slovakia. Your EtherTen will be on the way around the globe shortly. In the meanwhile thanks to everyone for taking the effort to enter our competition and having some fun. As always we had a few ineligible entries and a few rude ones. Why? I don’t know.

And of course thanks to our sponsor Freetronics! Stay tuned for the January competition which will be announced shortly. In the meanwhile I’d better get back to work and write something…

So have fun and keep checking into tronixstuff.com. Why not follow things on twitterGoogle+, subscribe  for email updates or RSS using the links on the right-hand column, or join our Google Group – dedicated to the projects and related items on this website. Sign up – it’s free, helpful to each other –  and we can all learn something.