Wednesday, October 24, 2012

Review: Gooliegum Electronics PIC Training Course and Development Board

Introduction

There are many types of microcontrollers on the market, and it would be fair to say one of the two most popular types is the Microchip PIC series. The PICs are great as there is a huge range of microcontrollers available across a broad range of prices. However learning how to get started with the PIC platform isn’t exactly simple. Not that we expect it to be, however a soft start is always better. There are some older books, however they can cost more than $100 – and are generally outdated. So where do you start?

It is with this problem in mind that led fellow Australian David Meiklejohn to develop and offer his PIC Training Course and Development Board to the marketplace via his companyGooliegum Electronics.

In his words:

There is plenty of material available on PICs, which can make it daunting to get started.  And some of the available material is dated, originally developed before modern “flash” PICs were available, or based on older devices that are no longer the best choice for new designs.  Our approach is to introduce PIC programming and design in easy stages, based on a solid grounding in theory, creating a set of building blocks and techniques and giving you the confidence to draw on as we move up to more complex designs.

So in this article we’ll examine David’s course package. First of all, let’s look at the development board and inclusions. Almost everything you will need to complete all the lessons is included in the package, including the following PIC microcontrollers:

You can choose to purchase the board in kit form or pre-assembled. If you enjoy soldering, save the money and get the kit – it’s simple to assemble and a nice way to spend a few hours with a soldering iron.

Although the board includes all the electronic components and PICs – you will need are a computer capable of running Microchip MPLAB software, a Microchip PICkit3 (or -2) programming device and an IC extractor. If you’re building the kit, a typical soldering iron and so on will be required. Being the  ultra-paranoid type, I bought a couple extra of each PIC to have as spares, however none were damaged in my experimenting. Just use common-sense when handling the PICs and you will be fine.

Assembly

Putting the kit board together wasn’t difficult at all. There isn’t any surface-mount parts to worry about, and the PCB is silk-screened very well:

The rest of the parts are shipped in antistatic bags, appropriately labelled and protected:

Assembly was straight forward, just start with the low-profile parts and work your way up. The assembly guide is useful to help with component placement. After working at a normal pace, it was ready in just over an hour:

The Hardware

Once assembled (or you’ve opened the packaging) the various sections of the board are obvious and clearly labelled – as they should be for an educational board. You will notice a large amount of jumper headers – they are required to bridge in and out various LEDs, select various input methods and so on. A large amount of jumper shunts is included with the board.

It might appear a little disconcerting at first, but all is revealed and explained as you progress through the lessons. The board has decent rubber feet, and is powered either by the PICkit3 programmer – however only if you need less than 30mA. It is recommended to use a regulated DC power source between 5 and 6V DC, such as from a plug-pack. Unfortunately the board doesn’t have a DC voltage regulator.

However there is a wide range of functions, input and output devices on the board – and an adjustable oscillator, as shown in the following diagram:

The Lessons

There is some assumed knowledge, which is a reasonable understanding of basic electronics, some computer and mathematical savvy and the C programming language.

You can view the first group of lessons for free on the kit website, and these are included along with the additional lessons in the included CDROM. They’re in .pdf format and easy to read. The CDROM also includes all the code so you don’t have to transcribe it from the lessons. Students start with an absolute introduction to the system, and first learn how to program in assembly language in the first group of tutorials, followed by C in the second set.

This is great as you learn about the microcontroller itself, and basically start from the bottom. Although it’s no secret I enjoy using the Arduino system – it really does hide a lot of the actual hardware knowledge away from the end user which won’t be learned. With David’s system – you will learn.

If you scroll down to the bottom of this page, you can review the tutorial summaries. Finally here’s a quick demonstration of the 7-segment displays in action:

Where to from here? 

Once you run through all the tutorials, and feel confident with your knowledge, the world of Microchip PIC will be open to you. Plus you now have a great development board for prototyping with 6 to 14-pin PIC microcontrollers. Don’t forget all the pins are brought out to the row of sockets next to the solderless breadboard, so general prototyping is a breeze.

Conclusion

For those who have mastered basic electronics, and have some C or C-like programming experience from using other development environments or PCs – this package is perfect for getting started with the Microchip PIC environment. Plus you’ll learn about assembly language – which is a good thing. I genuinely recommend this to anyone who wants to learn about PIC and/or move into more advanced microcontroller work. And as the entire package is cheaper than some books –  you can’t go wrong. The training course is available directly from the Gooliegum website.

Disclaimer - The Baseline and Mid-Range PIC Training Course and Development Board was a promotional consideration from Gooliegum Electronics.

In the meanwhile 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? And join our friendly 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, September 25, 2012

Exploring the TI MSP430 platform with Energia Arduino-compatible IDE

Introduction

Over the last year or so Texas Instruments have been literally pushing their MSP430 development platform hard by offering an inexpensive development kit – their LaunchPad. For around ten dollars (not everyone could get it for $4.30) it includes a development board with flash emulation tool and USB interface, two of their microcontrollers, crystal, USB cable and some headers. It was (is?) a bargain and tens of thousands of LaunchPads were sold. Happy days.


However after the courier arrived and the parcel was opened, getting started with the LaunchPad was an issue for some people. Not everyone has been exposed to complex IDEs or university-level subjects on this topic. And to get started you needed to use a version of Code Composer Studio or IAR Embedded Workbench IDEs, which scared a few people off. So those LaunchPads went in the cupboard and gathered dust.

Well now it’s time to pull them out, as there’s a new way to program the MSP430 using a fork of the Arduino IDE – Energia. Put simply, it’s the Arduino IDE modified to compile and upload code to the LaunchPad, which makes this platform suddenly much more approachable.

Getting Started

You’ll need to download and install the appropriate USB drivers, then the IDE itself from here. To install the IDE you just download and extract it to your preferred location, in the same manner as the Arduino IDE. Then plug your LaunchPad into the USB. Finally,  load the IDE. Everything is familiar to the Arduino user, except the only surprise is the colour (red as a nod to TI perhaps…):


Looking good so far. All the menu options are familiar, the files have the .ino extension, and the preferences dialogue box is how we expect it. Don’t forget to select the correct port using the Tools > Serial port… menu. You will also need to select the type of MSP430 in your LaunchPad. At the time of writing there is support for three types listed below (and the first two are included with the LaunchPad v1.5):

  • MSP430G2553 - <=16 MHz, 16KB flash, 512b SRAM, 24 GPIO, two 16-bit timers, UART, SPI, I2C, 8 ADC channels at 10-bit, etc. Cost around Au$3.80 each**
  • MSP430G2452 - <=16 MHz, 8KB flash, 256b SRAM, 16 GPIO, one 16-bit timer, UART, I2C, 8 ADC channels, etc. Cost around Au$2.48 each**
  • MSP430G2231 - <=16 MHz, 2KB flash, 128b SRAM, 10 GPIO, one 16-bit timer, SPI, I2C, 8 ADC channels, etc. Cost around Au$3.36 each**

** One-off ex-GST pricing from element14 Australia. In some markets it would be cheaper to buy another LaunchPad. TI must really be keen to get these in use.

There are some hardware<>sketch differences you need to be aware of. For example, how to refer to the I/O pins in Energia? A map has been provided for each MSP430 at the Energia wiki, for example the G2553:

As you can imagine, MSP430s are different to an AVR, so a lot of hardware-specific code doesn’t port over from the world of Arduino. One of the first things to remember is that MSP430s are 3.3V devices. Code may or may not be interchangeable, so a little research will be needed to match up the I/O pins and rewrite the sketch accordingly. You can refer to pins using the hardware designator on the LaunchPad (e.g. P1_6) or the physical pin number. For example – consider the following sketch:

void setup() {  // initialize the digital pins as an output. pinMode(P1_0, OUTPUT); // LED 1 pinMode(P1_6, OUTPUT); // LED 2 }
void loop() { digitalWrite(P1_6, HIGH);  digitalWrite(P1_0, HIGH);  delay(100);  digitalWrite(P1_6, LOW);  digitalWrite(P1_0, LOW);  delay(100);  }

You could have used 2 (for physical pin 2) instead of P1_0 and 14 (physical pin … 14!) instead of P1_6. It’s up to you. Another quick example is this one – when the button is pressed, the LEDs blink a few times:

const int redLED = P1_0; const int greenLED = P1_6; const int button = P1_3; // button S2 (on the left)
int a = 0; void setup() { pinMode(redLED, OUTPUT); pinMode(greenLED, OUTPUT);  pinMode(button, INPUT_PULLUP); // note _PULLUP digitalWrite(redLED, LOW); digitalWrite(greenLED, LOW);  }
void loop() { if (digitalRead(button)==LOW) { for (a=0; a<10; a++) { digitalWrite(redLED, HIGH); digitalWrite(greenLED, LOW);  delay(200); digitalWrite(redLED, LOW); digitalWrite(greenLED, HIGH);  delay(200); } digitalWrite(redLED, LOW); digitalWrite(greenLED, LOW);  } }

Due to the wiring of the LaunchPad, when you press the button, P1_3 is pulled LOW. For the non-believers, here it is in action:

So where to from here? There are many examples in the Energia IDE example menu, including some examples for the Energia libraries. At the time of writing there is: Servo, LiquidCrystal, IRremote, SPI, wire, MSPflash and Stepper. And as the Energia project moves forward more may become available. For help and discussion, head over to the 4-3-Oh forum and of course the Energia website. And of course there’s the TI MSP430 website.

Conclusion

Well that was interesting to say the least. If you have a project which needs to be low-cost, fits within the specifications of the MSP430, has a library, you’re not hung up on brand preference, and you just want to get it done – this is a viable option. Hopefully after time some of you will want to work at a deeper level, and explore the full IDEs and MSP430 hardware available from TI. But for the price, don’t take my word for it – try it yourself. 

In the meanwhile 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? And join our friendly 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, September 18, 2012

Kit Review – AVR ISP Shield

Introduction

In the last few weeks I needed to flash some ATmega328P microcontrollers with the Arduino bootloader. There are a few ways of doing this, and one method is to use an AVR ISP shield. It’s a simple kit to assemble and use, so let’s  have look at the process and results.

As the kit is manufactured by Sparkfun, it arrives in typical minimalist fashion:

The kit includes the following items:

That’s it – no URL to instructions or getting started guide or anything. Luckily we have a bit of knowledge behind us to understand what’s going on. The PCB has all the components as SMT including the status LEDs, so the only soldering required is the shield header pins and the six or ten-connector for the programming cable. You receive enough header pins to fit everything except for both six and ten – you can have one or the other, but not both. Having some handy I thought adding my own socket would be a good idea, however the pins are placed too closed to the group of six, nixing that idea:

Assembly

After collecting all my regular soldering tools and firing up the ‘888 it was time to get to work:

The first thing to fit were the shield headers. A simple way to do this is to break off the required lengths:

… then fit them to a matching board:

… then you place the shield on top and solder the pins. After that I used some of my own headers to fit both six and ten-pin ISP headers – it never hurts to do both, one day you might need them and not have soldering equipment at the ready. Finally the zero-insertion force (ZIF) socket goes in last. Push the lever down so it lays flat before soldering. Then you’re finished:

Operation

Now to program some raw microcontrollers. Insert the shield into your board. We used Arduino IDE v1.0.1 without modifying the original instructions from the Arduino team. Now upload the “ArduinoISP” sketch which is in the Examples menu. Once this has been successful the PLS LED will breathe. You then insert the microcontroller into the ZIF socket and gently pull the lever down. The notch on the microcontroller must be on the right-hand side when looking at the shield. Finally – check the voltage! There is a switch at the bottom-left of the shield that allows 5V or 3.3V.

Next  you need to select the target board for the microcontroller you’re programming. For example, if it’s going into a Uno – click Uno, even if you’re hosting the shield with an older board such as a Duemilanove. Next, choose the programmer type by selecting Tools > Programmer >  Arduino as ISP. Now for the magic – select Tools > Burn bootloader. The process takes around one minute, during which time the “PROG” LED on the shield will blink and flicker. It turns off once finished, and the IDE also notifies you of this. For the curious, the process is in the video below:

 

As you hopefully noticed earlier a cable is included which allows in-circuit programming from the shield to your existing project or prototype. However we didn’t have use for it at this time, it will come in handy when doing more advanced work later on.

Conclusion

It’s simple and it works. So if you need to flash a whole tube of raw micros with the Arduino bootloader, this is an option. In Australia you can get the kit from Little Bird Electronics. Full-sized images available on flickr. This kit was purchased without notifying the supplier.

In the meanwhile 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? And join our friendly 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.

Thursday, September 13, 2012

Internet-controlled relays with teleduino and Freetronics RELAY8:

This is chapter forty-seven of a series originally titled “Getting Started/Moving Forward with Arduino!” by John Boxall – A tutorial on the Arduino universe. The first chapter is here, the complete series is detailed here.

Welcome back!

In this article we’re going to look at controlling relays over the Internet. In doing so you will then be able to turn almost anything on and off as long as you have http access on an Internet-enabled device. Why would you want to do this? Connect an outdoor light – and turn it on before arriving home. Control the power to your TV setup – then you can control childrens’ TV viewing at a whim. Control farm water pumps without getting out of the truck. We’ll break this down into two stages. First we’ll explain how the RELAY8: relay control shield works and control it locally, then control it remotely using the teleduino service. We will be using Arduino IDE v1.0.1.

This tutorial will assume you have an understanding from three other articles – so please have a quick read of I2C bus, the MCP23017 I/O expander and teleduino. But don’t panic – we’ll try and keep it simple here.

The RELAY8: shield

First – our relay shield. We’ll be using the Freetronics RELAY8: shield:

Using the RELAY8: you can control eight relays using the I2C bus and the MCP23017 I/O expander – which saves your digital outputs for other purposes. There are three hardware settings you need to consider when using the shield:

  1. Power – how will you power the relay coils?
    • You can directly connect between 5 and 24V DC using the terminal block on the right-hand side of the shield – great for stronger relay coils.
    • You can power the relay coils using power from the Arduino. So whatever power is going to the Arduino Vin can power the shield. To do this jumper the two pins next to the Vin shield connector. In doing so – you must check that the combined current draw of all your relays on at once will not exceed what is available to the Arduino. Usually OK when using solid-state relays, as most examples use around 15mA of current to activate. However double-check your relay specifications before doing so.
    • You can also power the Arduino board AND the shield by feeding in external power to the shield and jumpering the two pins described above
  2. Which I2C address to use for each shield? By default it is 0×20. However you can jumper the three pairs of pins at the bottom-left of the shield to change the address. Each pair represents the last bit of the bus address – no jumper means zero, and a jumper means one. So if you jumper ADDR0, the address will be 0×21 – etc. Using this method you can then stack up to eight shields – and control 64 relays!
  3. Are you using an Arduino Leonardo baord? If so – your shield I2C pins aren’t A4/A5 – they’re over near the top of the board:

However this isn’t a problem. Solder in some header pins to the shield’s SCL/SDA holes (next to AREF). Then turn over the RELAY8: board and you will see some solder pads as shown below. With a thin knife, cut the copper tracks shown with the blue lines:

Doing this will redirect the I2C bus from the microcontroller to the correct pins at the top-left.

Once you have decided on your power and I2C-bus options, it’s time to connect the relays. Doing so is simple, just connect the +  and – from the relay coil to the matching position on your RELAY8: shield, for example:

Today we’re just using prototyping wires, so when creating a permanent installation ensure the insulation reaches the terminal block. When working with relays you would use a diode across the coil to take care of back-EMF – however the shield has this circuitry, so you don’t need to worry about that at all. And if you’re wanting to control more than one shield – they stack nicely, with plenty of clearance between shields, for example:

Now to test the shield with a quick demonstration. Our sketch will turn on and off each relay in turn. We use the addressing format described in table 1.4 of the MCP23017 data sheet,  The relays 1 to 8 are controlled by “bank A” of the MCP23017 – so we need to set that to output in our sketch, as shown below (download sketch):

// Example 47.1 #include "Wire.h" // for I2C bus #define I2C_ADDR 0x20 // 0x20 is the address with all jumpers removed
void setup() { Wire.begin(); // Wake up I2C bus
// Set addressing style Wire.beginTransmission(I2C_ADDR); Wire.write(0x12); Wire.write(0x20); // use table 1.4 addressing Wire.endTransmission();  // Set I/O bank A to outputs Wire.beginTransmission(I2C_ADDR); Wire.write(0x00); // IODIRA register Wire.write(0x00); // Set all of bank A to outputs Wire.endTransmission(); }
int period = 500;
void loop() { byte relay = 1; for (int i=1; i<9; i++) { // turn on relay  Wire.beginTransmission(I2C_ADDR); Wire.write(0x12); // Select bank A Wire.write(relay); // Send value to bank A Wire.endTransmission();  delay(period);
// turn off all relays Wire.beginTransmission(I2C_ADDR); Wire.write(0x12); // Select bank A Wire.write(0); // Send value to bank A Wire.endTransmission();  delay(period);  relay = relay * 2; // move to next relay } }

The sketch simply sends the values of 1, 2, 4, 8, 16, 32, 64 and 128 to the shield – each value in turn represents relays 1 to 8. We send 0 to turn off all the relays. Here’s a quick video showing it in action – the LEDs on the shield show the relay coil power status:

Now there is one small caveat – every time you send a new command to the MCP23017, it overwrites the status of the whole bank of pins. For example if relay 3 is on, and we send the value 2 – this will turn on relay 2 and turn off 3. Why? Because the values are converted to binary when heading down to the relay shield. So if we send 1, in binary this is:

00000001

which turns on relay 1 – and turns off relays 2 to 7. But then if we send 4 to turn on relay 3, in binary this is:

00000100

which turns on relay 3, but turns off relays 1, 2, and 4 to 8. So how do we turn on or off all eight relays at once? Just do a little binary to decimal conversion. Let’s say you want relays 1, 3, 5 and 7 on – and 2, 4, 6 and 8 off. In binary our command value would be:

01010101

and in decimal this is 85. Want to turn them all on at once? Send 255. Then all off? Send zero.

Now let’s do it via the Internet…

You’re going to need an Ethernet-enabled Arduino board. This could involve adding an Ethernet shield to your existing board, or using an all-in-one board like the Freetronics EtherTen. We will now use the teleduino service created by Nathan Kennedy to send commands to our Arduino boards via the Internet. At this point, please review and understand theteleduino article – then, when you can successfully control a digital output pin – return here to continue.

First, get the hardware together. So ensure your relay shield is in the Arduino and you have uploaded the

TeleduinoEthernetClientProxy.ino

sketch. For the first couple of times, it’s good to still have the teleduino status LED connected – just to keep an eye on it. Plug your Arduino into your router and the power. After it connects to teleduino (four blinks of the status LED) we have to send three commands via http. The first tells teleduino that we’re sending I2C commands. You only do this once after every Arduino reset of power-up situation. It is:

https://us01.proxy.teleduino.org/api/1.0/328.php?k=999999r=defineWire

Remember to replace 999999 with your teleduino key. Next, just like in the example 47.1 sketch we need to send the configuration bytes to the MCP23017 just like in void setup(). To do this, use

https://us01.proxy.teleduino.org/api/1.0/328.php?k=999999&r=setWire&address=32&bytes=%12%00

Can you see what happened? In the URL above we send the bytes 0×12 then 0×00 to device address 0×32. Then we send

https://us01.proxy.teleduino.org/api/1.0/328.php?k=999999&r=setWire&address=32&bytes=%00%00

At this stage the relay shield is now ready to accept your bytes to turn on and off the outputs. Again, just like the sketch – we send two bytes. For example:

 https://us01.proxy.teleduino.org/api/1.0/328.php?k=999999&r=setWire&address=32&bytes=%12%FF

turns on all the outputs – however with the URL we need to send the byte representing the outputs in hexadecimal. So 255 is FF, 0 is 0, etc. For example to turn them all off, use:

https://us01.proxy.teleduino.org/api/1.0/328.php?k=999999&r=setWire&address=32&bytes=%12%00

or to turn on outputs 1, 2, 3 and 4 use:

https://us01.proxy.teleduino.org/api/1.0/328.php?k=999999&r=setWire&address=32&bytes=%12%0F

Simple. You can simply bookmark your URLs for later use as well – and don’t forget to use a URL-shortener such as bit.ly to makes things simpler for you.

Conclusion

Now you have a way to control many relays either locally or remotely over the Internet. I hope you found this article useful or at least interesting. If you have any suggestions for further articles (and not thinly-veiled methods of asking me to do your work for you…) – email them to john at tronixstuff dot com. Thanks to Freetronics for the use of their hardware and Nathan Kennedy for teleduino, his support and advice.

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, September 2, 2012

Initial review: Aery32 Atmel AVR32 UC3A1 Development Board

finally … we’re back!

Introduction

Recently (!) one of my readers sent me the subject of our review – the Aery32 development board from Finland. Based around theAtmel AVR32 UC3A1 128KB microcontroller – it is a painless way to get into AVR32 programming and development. Furthermore the hardware and software are completely open-source, so you can make your own and modify to your heart’s content. The specifications of the Atmel AVR32 UC3A1 show that it is an incredibly powerful microcontroller and they can be found in detail from Atmel here - plus you can download the data sheet from here.

Regular readers will know that I don’t work with this platform, so this review is written from the point of an absolute beginner. My apologies if some of the terminology used isn’t the norm. Moving forward, here is our Aery32 board:

… and the rear:

One could say that there is everything you need – and nothing you do not. Looking at the front of the board, apart from the MCU there is an LED for use, the mini-USB for programming and a switch for changing modes between the bootloader and program. On the rear are the pin references, and on the right-hand side solder pads (on both sides) for the JTAG debugger.  The following video is a short walkthrough:

Setup

The first thing to do is get the required software installed on the machine. Instructions for Windows, MacOS and Linux are provided. Here we have Windows 7 and the installation was simple enough – the Atmel software installed painlessly enough. You will also need the Aery32 software framework, which contains source files and compiling instructions for your projects. This is updated over time by the Aery32 project, so keep an eye on the github page.

After downloading the framework, keep an unaltered copy in a folder. Then you copy this and rename it for each new project. That is - for each project you start with a fresh framework folder and insert the code into the main.cpp file within the folder. Consider the following:

You can see how I have kept the framework in a folder to keep as a source, then made copies and renamed them for individual projects. Then inside each folder you have the various files – and the main.cpp which contains your project code.

Using the Aery32

From the beginning I was a little worried due to my lack of time and inexperience with AVR32 programming. However after determing how the software framework and code files are used as described earlier – the process of programming the board was easy. You then just need to learn how to program – a topic for another day… In the meanwhile, blinking the LED as a test was simple enough. After making a separate folder (see the image above) one simply edits the main.cpp file and adds the required code. For example – to blink the onboard LED:

#include "board.h" #include <aery32/all.h> using namespace aery; int main(void) { /* Put your application initialization sequence here */ init_board(); gpio_init_pin(LED, GPIO_OUTPUT); for(;;) { gpio_toggle_pin(LED); delay_ms(250); } return 0; }

Next, make sure the switch on the Aery32 is moved towards the reset button – this puts the board into bootloader mode. Plug in the USB cable, wait for recognition – then from the command prompt, navigate to the folder which contains the code and enter make program start. If all goes well you will see the following:

And if it doesn’t, the various errors are described as necessary. As you can see all the compilation and uploading is scripted for you making the whole process very simple. Then move the switch away from the reset button – which puts the board in run mode, then press reset. For anything further you’re going to need some external wiring – so for further experimenting purposes the first thing I did was solder in some standard 0.1″ dual inline header pins to allow easy access to a variety of I/O pins and GND. Although wanting to do more I’m pretty time-constrained at the moment so came up with not one but four blinking LEDs. Here’s the code:

#include "board.h" #include <aery32/all.h>
using namespace aery;
int main(void) { /* Put your application initialization sequence here */ init_board(); // set I/O pins to output
gpio_init_pin(AVR32_PIN_PA00, GPIO_OUTPUT); gpio_init_pin(AVR32_PIN_PA01, GPIO_OUTPUT); gpio_init_pin(AVR32_PIN_PA02, GPIO_OUTPUT); gpio_init_pin(AVR32_PIN_PA03, GPIO_OUTPUT);
for(;;) {
gpio_toggle_pin(AVR32_PIN_PA00); delay_ms(250); gpio_toggle_pin(AVR32_PIN_PA01); delay_ms(250); gpio_toggle_pin(AVR32_PIN_PA02); delay_ms(250); gpio_toggle_pin(AVR32_PIN_PA03); delay_ms(250); } return 0; }

and for the non-believers – the board in action:

Aery32-specific information and help is easy to find. For an open-source project, the documentation is extensive and includes many examples. Have a look around the documentation site to see what I mean. There is also a developer area which contains many articles about using the Aery32 and various examples within.

Conclusion

From my (beginner’s) perspective this board was very easy to setup and get working. Not having to worry about downloading hundreds of megabytes of IDE was great and allows programming from lightweight machines. And there is not doubt about the power or I/O features of the AVR32 UC3A1. Now I’ll get myself a good AVR32 book So if you’re looking for a powerful and well-supported AVR32 development board, theAery32 is a good start. You can order the board directly from the website at http://www.aery32.com/.

In the meanwhile 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? And join our friendly 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, July 17, 2012

How to expand your Arduino's SRAM

When working with more complex Ardiuno projects you may find that there isn't enough SRAM - the memory used for storing and manipulating variables when a sketch is running. A typical Arduino board such as the Uno only has two kilobytes, which can run out quickly. Of course there is the internal EEPROM, however this is slower and has a finite life. Australian Nick Gammon has described a way to use additional, external SRAM ICs via the SPI bus with an Arduino to increase the temporary memory that is simple and inexpensive. 

For more information an Nick's detailed tutorial, visit his site here. And for more news, updates and items of interest.please follow us  on twitterFacebook and Google+. Another way to increase all three memories of an Arduino (SRAM, flash memory and EEPROM) is to upgrade your project to the Arduino Mega2560:

Not only does the Mega2560 have 54 digital and 16 analog input pins, it has eight kilobytes of SRAM, as well as 256 kilobytes of flash memory. Therefore by using a Mega2560 - you have more sketch room, more variable space, and a bucketload of I/O.

Friday, July 13, 2012

Wireless interaction with netduino and Windows Phone 7

Windows Phone and .net enthusiast Georgi has demonstrated how to create interaction between the netduino plus and his Windows 7 Phone by the use of the Modbus-TCP library. It is possible to read and write digital I/O, as well as send analog input values from the netduino plus back to the Windows phone. You can watch his demonstration in the following video:

 

The code is relatively straightforward, and gives you a base to create your own remote-control applications using the Microsoft environment. For more information visit Georgi's blog here, and to download the code visit here. If you are new to netduino or interested in using the platform, we have a variety of products to get you moving. Starting with the book "Getting Started with netduino", then a range of boards including the netduino and netduino plus:

 

... which share the Arduino form factor so you can use a wide range of protoshields. And for more news, updates and items of interest.please follow us on twitterFacebook and Google+

Using an AVR as an RFID card

For something somewhat left of field, electronics enthusiast Beth has documented how to use an Atmel ATtiny85 microcontroller as an RFID card. Naturally it still needs a large coil, however this can fit within the dimensions of a typical RFID card:

 

The ATtiny is powered in a clever way. The current from the RFID reader device eventually causes a sine wave of a few volts through the coil, which is connected to the I/O pins. As that voltage exceeds the supply voltage, the excess is diverted to the supply rails via the clamping diodes on the I/O. Ingenious. To read about the design and download the source code, visit Beth's fascinating blog here.

To get started with your own home-brew RFID card, we have the ATtiny85 available for fast delivery along with the rest of our wide-ranging catalogue. And if you don't feel like making your own RFID card, we have those as well. And for more news, updates and items of interest.please follow us on twitterFacebook and Google+

Wednesday, June 27, 2012

Improving Arduino to PC Interactions with MegunoLink

Introduction

Through a colleague I was introduced to a new piece of software for the Windows environment which comprises of useful tools that interact with an Arduino-style board (or other MCU with serial data). The software is called MegunoLink, fromBlueLeafSoftware in New Zealand. Megunolink has many useful features, and we’ll run through them briefly in this article. They include:

  • Serial port monitoring – that doesn’t reset the MCU
  • The ability to capture serial port data to a text file
  • A tool to graph formatted data sent from the Arduino in real time
  • “George” the serial monkey! (see below)
  • Enable building Arduino projects using ATMEL AVRstudio
  • And Megunolink can also act as a graphical interface for AVRdude to upload compiled code to an Arduino

Installation was simple and straightforward. The installation is only ~1.5 megabytes and not taxing at all. We only have a Windows 7 64-bit machine, so haven’t tested this in emulation under MacOS or Linux. Before moving ahead, note that the software is free. However the developers do ask for a US$10 donation, and if you use the software more than once this is a very fair amount to pay for such a featured piece of software. Now for a look at each of the features.

Serial Data monitoring

As with the Serial Monitor in the Arduino IDE, you can monitor the data from the Arduino, and also send it back through the serial line. Just click the ‘Monitor’ tab and you’re set, for example:

However unlike the Arduino IDE, opening the monitor does not reset the Arduino. But if you do need to perform a reset, a button on the toolbar is provided as shown below:

Capturing Serial Data to a file

Very useful indeed, much quicker than dumping data to a microSD card and then bringing it back to the PC. Just click the ‘Log’ tab, specify a file location and name, then click ‘Enabled’, for example:

You can also append data to an existing text file. When creating the output format in your Arduino sketch, be mindful to have separators such as commas or colons – which make it much easier to delimit the data once imported into a spreadsheet or database application.

Plotting and Graphing Serial Data

Plotting data to a graph is very simple. You simply format the data you’d like to plot using Serial.write commands, and Megunolink takes care of the rest – just click the ‘Plotter’ tab and you’re off.  The data must be formatted as such:

{a, T, b}

Where ‘a’ is the name of the series. T tells MegunoLink to plot the actual real time, and b is the data as a number in string form. Here is a very simple example:

void setup() { Serial.begin(9600); }
int a=0; float b,c;
void loop() { for (int a=0; a<100; a++) { b=a/2; c=a*2; Serial.print("{a,T,");  Serial.print(a); Serial.println("}"); Serial.print("{b,T,"); Serial.print(b); Serial.println("}");  Serial.print("{c,T,"); Serial.print(c); Serial.println("}");  delay(100); } for (int a=100; a>0; --a) { b=a/2; c=a*2; Serial.print("{a,T,");  Serial.print(a); Serial.println("}"); Serial.print("{b,T,"); Serial.print(b); Serial.println("}");  Serial.print("{c,T,"); Serial.print(c); Serial.println("}");  delay(100); } }

which resulted with:

Here is another example, it is the “SendSineCurve” sketch from the Arduino Graphing library:

You can always save the graph as an image in the usual formats as well as in .emf vector image file format.

“George” the Serial Monkey

 This is a serial protocol simulator tool which is useful for testing the control of serial-based devices. You can setup George so that it listens for a particular pattern in the serial output from an Arduino – and then sends back a response of your choice to the Arduino. For example:

For a more detail explanation and detail tutorial on how to control George, see the MegunoLink website.

Arduino Development with AVR Studio 

Using MegunoLink you can develop Arduino projects with Atmel AVRStudio software. As some people find the Arduino IDE somewhat limiting, this option gives you access to the more programmer-friendly Atmel IDE, for example:

Although there is a small amount of tasks to make this possible, it is straightforward to do so, and an easy to follow tutorial has been provided at the MegunoLink website.

Upload compiled .HEX files to Arduino

For those using avrdude to upload compiled .hex files to an Ardiuno, you can also do this using the GUI MegunoLink interface. This is also used for uploading the compiled files generated in AVRStudio, for example:

As with all the other MegunoLink features – there is a relevant tutorial available on the website.

Conclusion

MegunoLink works well, is easy to use, and the price is right. It has to be the simplest tool available for plotting data from a microcontroller, or capturing it to a file without any extra hardware. So download it and give it a try, it won’t cost you anything and I’m sure you will find a use for it in the near future. And remember – if you’re using MegunoLink, please consider making a donation towards the development of further versions. Thanks to Freetronics for the use of their top-notch Arduino-compatible hardware.

In the meanwhile 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? And join our friendly 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.