In March this year we discussed a project by Phillip Stevens to crowd-fund an Arduino-compatible board with an ATmega1284p microcontroller – the “Goldilocks”. After being funded at a rapid rate, and subjected to some community feedback – the boards have now been manufactured and delivered to those who pledged. If you missed out – there’s some more available for direct sales. We ordered five and now have them for the subject of this review – and two to give away. So let’s examine the board and see what’s new.

What is it?

After hitting the limits of the Arduino Uno with respect to SRAM, CPU speed and not wanting to lose compatibility with existing projects by changing platforms, Philip decided to shift the MCU up to the ATmega1284P. This offers eight times the SRAM, four times the flash memory and EEPROM – and is also clocked at 20 MHz instead of the usual 16 MHz on Unos, etc. After the original design was announced, it was the victim of some pretty heavy feature-creep – however with Freetronics as the manufacturing partner the final result is a nicely-finished product:

Now let’s rip open the packaging and examine the board in greater detail. From the images below you can get the gist of things… starting with the top you can see the ATmega1284P next to the microSD card socket. There’s a JTAG connector for the 1284P on its left – and below that a 32.768 kHz crystal for RTC use. And like other Freetronics boards a large prototyping area has been squeezed in below pins D0~7 that also has the power and I2C lines at the edge. Furthermore note that all I/O pins are brought out to separate holes in alignment with the header sockets. And my favourite – a switch-mode power supply circuit that can offer up to 2A of current – great for GSM shields.

Another point of interest is the ATmega32U2 microcontroller which is for USB duties – however it can be used as a separate “board” on its own, with a separate reset button, ICSP breakout and the ports are broken out logically:

Furthermore the 32U2’s SPI bus can be wired over to the main 1284P to allow communication between the two – simply by bridging the provided pads on the PCB you can join them. Also on the bottom you can see how each I/O pin can be disconnected from the I/O areas and thus diverted if necessary. It really is a testament to the design that so much of the board is customisable, and this attention to detail makes it stand apart from the usual Arduino-compatibles out there.

One thing that did strike me was the retina-burning intensity of the onboard LEDs – however you can disable them by cutting the provided track on the PCB. For a complete explanation of the hardware side of things, check out the user guide.

Using the Goldilocks

One of the main goals was to be Arduino Uno R3-compatible, and from initial examination this is certainly the case. However there are a couple of differences, which you can find out more about in the user guide. This is not the first board for an Arduino user, but something chosen after getting some experience. Installation was very easy, it should be plug-and-play for the non-Windows crowd. However if you’re part of the silent majority of Windows users then the required U2duino Programmer.inf file for the Device Manager will be found in the production_firmware folder of the software download available on the product page. Furthermore no matter your OS – don’t forget to install the Arduino IDE Goldilocks board profile.

Before getting too excited and uploading your sketches, you can examine the the ATmega1284p bootloader monitor which allows for memory dumps, port testing, and more. Simply connect up your board, load the Arduino IDE, select the board and COM: port then open the Serial Monitor. By sending “!!!” after a board reset, a simple menu appears – which is shown in the following video:

Now for a quick speed test. We’ll use a sketch written by Steve Curd from the Arduino forum. It calculates Newton Approximation for pi using an infinite series:

Arduino

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

// Pi_2 by Steve Curd // December 2012

// This program approximates pi utilizing the Newton's approximation. It quickly

// converges on the first 5-6 digits of precision, but converges verrrry slowly

// after that. For example, it takes over a million iterations to get to 7-8

// significant digits.

#define ITERATIONS 100000L // number of iterations

#define FLASH 1000 // blink LED every 1000 iterations

voidsetup()

{

pinMode(13,OUTPUT);// set the LED up to blink every 1000 iterations

Serial.begin(57600);

}

voidloop()

{

unsignedlongstart,time;

unsignedlongniter=ITERATIONS;

intLEDcounter=0;

booleanalternate=false;

unsignedlongi,count=0;

floatx=1.0;

floattemp,pi=1.0;

Serial.print("Beginning ");

Serial.print(niter);

Serial.println(" iterations...");

Serial.println();

start=millis();

for(i=2;i<niter;i++){

x*=-1.0;

pi+=x/(2.0f*(float)i-1.0f);

if(LEDcounter++>FLASH){

LEDcounter=0;

if(alternate){

digitalWrite(13,HIGH);

alternate=false;

}else{

digitalWrite(13,LOW);

alternate=true;

}

temp=40000000.0*pi;

}

}

time=millis()-start;

pi=pi*4.0;

Serial.print("# of trials = ");

Serial.println(niter);

Serial.print("Estimate of pi = ");

Serial.println(pi,10);

Serial.print("Time: ");Serial.print(time);Serial.println(" ms");

delay(10000);

}

The Goldilocks was compared with a standard Arduino Uno, with the following results (click image to enlarge):

As you can see from the results below, the Goldilocks theoretical extra 4 Mhz of speed is shown in the elapsed time between the two boards – 4433 ms for the Goldilocks vs. 5562 ms for the Uno, a 25.4% increase. Looking good. We’ll leave it for now – however for more information you can review the complete user manual, and also discuss Goldilocks in the Freetronics customer forum.

Competition

Two of our twitter followers will be randomly selected on the 14th of September, and will each receive one Goldilocks board. So follow us on @tronixstuff for a chance to win a board, and also keep up with news, new articles and items of interest. Board will be delivered by Australia Post standard air mail. We’re not responsible for customs or import duties, VAT, GST, import duty, postage delays, non-delivery or whatever walls your country puts up against receiving inbound mail.

Conclusion

The Goldilocks is the board that can solve many problems – especially when you’ve outgrown your Uno or similar board. We look forward to using it with larger projects that burn up SRAM and exploring the possibilities of using the two microcontrollers at once. There’s a whole bundle of potential – so congratulations to Phillip Stevens, Freetronics and all those who pledge to the funding and supported the project in general. And to join in – you can get your own from Freetronics. Full-sized images are on flickr. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, 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.

For those of you prototyping with larger Atmel AVR microcontrollers such as the ATmega32, it can be inconvenient to continually assemble a circuit onto a solderless breadboard that includes power, programming header and a few basics – or you might want to create a one-off product without waiting for a PCB to be made. If these are issues for you, or you’re interested in working with AVRs then the subject of this review may be of interest – the ATmega32 Development Kit from Protostack. The kit is one of a range that spans from the ATmega8, and gives you almost everything needed to work with the microcontroller. We’ve assembled and experimented with the ATmega32 kit, so read on to find out more.

Assembly

The kit arrives in a typical anti-static package with the contents and URL on the front:

The PCB is large, measuring 127 x 94 mm, made from heavy 1.6 mm FR4 PCB and all the holes are through-plated. And as you can see from the images below, there’s plenty of prototyping space and power/GND rails:

The included parts allow you to add a power supply, polyfuse, smoothing capacitors for the power, programmer socket, external 16 MHz crystal, a DC socket, IC socket, a lonely LED and of course the ATmega32A (which is a lower-power version of the ATmega32):

You can download the user guide from the product page, which details the board layout, schematic and so on. When soldering the parts in, just start with the smallest-profile parts first and work your way up. There’s a few clever design points, such as power regulator – there’s four holes so you can use both “in-GND-output” and “GND-output-input” types:

… and the layout of the prototyping areas resemble that of a solderless breadboard, and the power/GND rails snake all around – so transferring projects won’t be difficult at all:

If you need to connect the AVcc to Vcc, the components and board space are included for a low-pass filter:

And if you get carried away and need to use two or more boards at once – they’re stackable:

Moving forward

After assembling the board and inserting the ATmega32, you can use an AVR programmer to check it’s all working (and of course program it). With a 10-pin interface USBASP inserted, I headed over to the AVRdude folder on my PC and entered:

Arduino

1

avrdude-cusbasp-pm32

which (as all was well) resulted with:

Awesome – it’s nice to have something that just works. Let the experimenting begin!

Conclusion

It’s a solid kit, the PCB is solid as a rock, and it worked. However it could really have used some spacers or small rubber feet to keep the board off the bench. Otherwise the kit is excellent, and offers a great prototyping area to work with your projects. If you order some, Protostack have a maximum delivery charge of $9 so you won’t get burned on delivery to far-flung places. Larger photos available on flickr. And if you made it this far – check out my new book “Arduino Workshop” from No Starch Press.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, 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.

In this article we review a couple of SMT prototyping boards from Schmartboard.

Introduction

Sooner or later you’ll need to use a surface-mount technology component. Just like taxes and myki* not working, it’s inevitable. When the time comes you usually have a few options – make your own PCB, then bake it in an oven or skillet pan; get the part on a demo board from the manufacturer (expensive); try and hand-solder it yourself using dead-bug wiring or try to mash it into a piece of strip board; or find someone else to do it. Thanks to the people at Schmartboard you now have another option which might cost a few dollars more but guarantees a result. Although they have boards for almost everything imaginable, we’ll look at two of them – one for QFP packages and their Arduino shield that has SOIC and SOP23-6 areas.

QFP 32-80 pin board

In our first example we’ll see how easy it is to prototype with QFP package ICs. An example of this is the Atmel ATmega328 microcontroller found on various Arduino-compatible products, for example:

Although our example has 32 pins, the board can handle up to 80-pin devices. You simply place the IC on the Schmartboard, which holds the IC in nicely due to the grooved tracks for the pins:

The tracks are what makes the Schmartboard EZ series so great – they help hold the part in, and contain the required amount of solder. I believe this design is unique to Schmartboard and when you look in their catalogue, select the “EZ” series for this technology. Moving forward, you just need some water-soluble flux:

then tack down the part, apply flux to the side you’re going to solder – then slowly push the tip of your soldering iron (set to around 750 degrees F) down the groove to the pin. For example:

Then repeat for the three other sides. That’s it. If your part has an exposed pad on the bottom, there’s a hole in the centre of the Schmartboad that you can solder into as well:

After soldering I really couldn’t believe it worked, so probed out the pins to the breakout pads on the Schmartboard to test for shorts or breaks – however it tested perfectly. The only caveat is that your soldering iron tip needs to be the same or smaller pitch than the the part you’re using, otherwise you could cause a solder bridge. And use flux! You need the flux. After soldering you can easily connect the board to the rest of your project or build around it.

This is the AD5204 four-channel digital potentiometer we used in the SPI tutorial. It sits nicely in the shield and can be easily soldered onto the board. Don’t forget the flux! Although the SMT areas have the EZ-technology, I still added a little solder of my own – with satisfactory results:

The SOT23-6 also fits well, with plenty of space for soldering it in. SOT23? Example – the ADS1110 16-bit ADC which will be the subject of a future tutorial:

Working with these tiny components is also feasible but requires a finer iron tip and a steady hand.

Once the SMT component(s) have been fitted, you can easily trace out the matching through-hole pads for further connections. The shield matches the Arduino R3 standards and includes stacking header sockets, two LEDs for general use, space and parts for an RC reset circuit, and pads to add pull-up resistors for the I2C bus:

Finally there’s also three 0805-sized parts and footprints for some practice or use. It’s a very well though-out shield and should prove useful. You can also order a bare PCB if you already have stacking headers to save money.

Conclusion

If you’re in a hurry to prototype with SMT parts, instead of mucking about – get a Schmartboard. They’re easy to use and work well. Full-sized images available on flickr.

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, 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.

The boards used in this article were a promotional consideration supplied by Schmartboard.

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?

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, or a regulated DC power source between 5 and 6V DC, such as from a plug-pack if you want to operate your board away from a PC.

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:

Update – 18/06/2013

David has continued publishing more tutorials for his customers every few months – including such topics as the EEPROM and pulse-width modulation. As part of the expanded lessons you can also get a pack which allows experimenting with electric motors that includes a small DC motor, the TI SN75441 h-bridge IC, N-channel and P-channel MOSFETS and more:

So after the initial purchase, you won’t be left on your own. Kudos to David for continuing to support and develop more material for his customers.

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 Gooligum website.

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

In the meanwhile have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, 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.

Recently (!) one of my readers sent me the subject of our review – the Aery32 development board from Finland. Based around the Atmel 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 – 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:

Arduino

1

2

3

4

5

6

7

8

9

10

11

12

13

14

#include "board.h"

#include <aery32/all.h>

usingnamespaceaery;

intmain(void)

{

/* Put your application initialization sequence here */

init_board();

gpio_init_pin(LED,GPIO_OUTPUT);

for(;;){

gpio_toggle_pin(LED);

delay_ms(250);

}

return0;

}

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:

Arduino

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

#include "board.h"

#include <aery32/all.h>

usingnamespaceaery;

intmain(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);

}

return0;

}

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 no 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, the Aery32 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 twitter, Google+, 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.

Time again for another kit review. Today we will examine the FreeduinoArduino Duemilanove-compatible board in a kit. It is always interesting to see how the different types and makes of Arduino-compatible boards present themselves, so this is review is an extension of that curiosity. This kit was originally designed by NKC Electronics and released under a Creative Commons license.

The packaging can either be classed as underwhelming or environmentally-friendly, as the kit arrives in several plastic resealable bags. Upon emptying them out we are presented with the following, the parts:

and the PCB:

Hopefully you noticed what ends up being the key features of this kit – the pre-soldered FTDI IC and mini-USB socket. This means the Freeduino can be used with a USB cable (not included) and not an expensive FTDI cable. The PCB itself is very solid, has a very descriptive silk-screen layer with all the component positions labelled, is solder-masked, and has nice rounded corners.

Reviewing the included parts did make me wonder why the supplier has used 5% carbon-film resistors and ceramic capacitors instead of polyesters (except for one). It turns out that Seeedstudio (the distributor for my example kit) claim 5% resistors are easier to read. Originally I claimed that this was an excuse to save a few cents, however a few people have said that such resistors are easier to read.

Furthermore, this one missed out on the polyfuse for USB overcurrent and short-circuit protection. And whether or not the larger tolerances affect the operation of the board, the cheaper components make the finished product look very 1977. However on a brighter note, an IC socket is included.

Assembly was quick and simple, and you can also follow the silk-screen labels on the PCB as well. A good method is to start with the lowest-profile components, such as resistors and capacitors:

… then followed by the capacitors, crystal, LEDs and reset button:

Notice how the ceramic capacitors lead-spacing is too narrow for the holes on the PCB – this makes me think that the distributor has skimped out on the final product and been too lazy to update the PCB layout. The ATmega168 label is an example of this. Moving forward, the voltage regulator and sockets. The easiest way to solder in the shield sockets is to place them into the pins of an Arduino shield and solder – as such:

And there you have it, one Freeduino v1.22 Arduino Duemilanove-compatible board:

The image above also displays another bugbear with this kit – the LED placement. When you have a shield inserted, all of the LEDs are covered up. Furthermore, unlike other Arduino board kits you are stuck with the maximum current output of 50mA for the 3.3V rail as there isn’t a dedicated 3.3V voltage regulator on board. Finally, the power switching between USB and the DC socket is controlled with a jumper and header pins between the USB socket and the 7805 voltage regulator.

Although I might have sounded a little harsh about this kit, it is relatively inexpensive, easy to assemble, and has the USB interface onboard. These are all good things. However the PCB layout could have been improved by correctly spacing the holes for the ceramic capacitors, and moving the LEDs to the end of the board so they are visible with shields inserted. What’s the point of having all those LEDs if you cannot see them…

And finally a plug for my own store – tronixlabs.com – offering a growing range and Australia’s best value for supported hobbyist electronics from adafruit, DFRobot, Freetronics, Seeed Studio and much much more.

As always, have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, subscribe for email updates or RSS using the links on the right-hand column, or join our forum – dedicated to the projects and related items on this website.

Today we continue to examine Arduino-compatible products by assembling an interesting kit from Modern Device Company – their “Bare Bones Board” (to be referred to as BBB). The BBB kit is an inexpensive way to take advantage of the Arduino Duemilanove-compatible platform, and also fills some gaps in the marketplace. Unlike the usual Arduino and compatible boards, the BBB does not maintain the recognisable form factor – that is, you cannot use the variety of Arduino shields. However, the BBB does have all the input and output connections, just in different positions.

So why would you use this kit? If you are looking to create a more permanent Arduino-based project that did not require a shield, and you are in a hurry – the BBB could be easily integrated into your design. Money is saved by not having the usual USB connection, so uploading your sketch is achieved using a 5V FTDI cable or using another Arduino board as the programmer.

Furthermore, the PCB is designed in a way that allows you to plug the BBB into the side of a solderless breadboard, which allows prototyping more complex Arduino-based circuits very easy. But more about that later. For now, let’s have a look at construction. An excellent set of instructions and a guide to use is available for download here.

In the spirit of saving money, the kit arrives in a plastic bag of sorts:

And upon emptying the contents, the following parts are introduced:

Regular readers would know that the inclusion of an IC socket makes me very happy. The PCB is thicker than average and has a great silk-screen which makes following instructions almost unnecessary. One of the benefits of this kit is the ability to connect as little or as many I/O or programming pins as required.

And for the pins A0~A5, 5V, GND and AREF you are provided with header pins and a socket, allowing you to choose. Or you could just solder directly into the board. These pins are available on the bottom-left of the PCB. However there was one tiny surprise included with the parts:

This is a 15uH SMD inductor, used to reduce noise on the analog/digital section. According to the instructions, this was originally required with Arduino-style boards that used the ATmega168 microcontroller – however the BBB now includes the current ATmega328 which does not require the inductor. However, it is good to get some SMD practice, so I soldered it in first:

Well it works, so that was a success. Soldering the rest of the main components was quite simple, thanks to the markings on the PCB. The key is to start with the lowest-profile (height) components (such as that pesky inductor) and work your way up to the largest. For example:

As you can see from the PCB close-up above, you can have control over many attributes of your board. Please note that the revision-E kit does include the ATmega328 microcontroller, not the older ‘168. For more permanent installations, you can solder directly into I/O pins, the power supply and so on.

Speaking of power, the included power regulator IC for use with the DC input has quite a low current rating – 250 mA (below left). For my use, this board will see duty in a breadboard, and also a 5V supply for the rest of the circuit, so more current will be required. Thankfully the PCB has the space and pin spacing for a 7805 5V 1A regulator (below right), so I installed my own 7805 instead:

Finally, to make my Arduino-breadboarding life easier I installed the sockets for the analogue I/O, the DC socket and a row of header pins for the digital I/O. Below is my finished example connected into a breadboard blinking some LEDs:

In this example, the board is being powered from the 5V that comes along the FTDI cable. If doing so yourself, don’t forget that there is a maximum of 500 mA available from a USB port. If you need more current (and have installed the 7805 voltage regulator) make use of the DC socket, and set the PCB power select jumper to EXT. For a better look at the kit in action, here is a short video clip:

As you can see from the various angles shown in the video, there are many points on the PCB to which you can use for power, ground, I/O connection and so on. As illustrated at the beginning of this article, a variety of header pins are included with the kit. And please note that the LED on the board is not wired into D13 as other Arduino-type boards have been… the BBB’s LED is just an “on” indicator.

However if you are using this type of kit, you most likely will not need to blink a solitary LED. However some people do use the D13 LED for trouble-shooting, so perhaps you will need it after all. Each to their own!

In conclusion, the BBB is another successful method of prototyping with the Arduino system. The kit was of a good quality, included everything required to get working the first time, and is quite inexpensive if you have a 5V FTDI cable or an Arduino Duemilanove/Uno or compatible board for sketch uploading.

Once again, thank you for reading this kit review, and I look forward to your comments and so on. Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts, and if you have any questions – why not join our Google Group? It’s free and we’re all there to learn and help each other.

Today we are going to spend some time with a touch screen very similar to the ones found in a Nintendo DS gaming unit. In doing so, we can take advantage of a more interesting and somewhat futuristic way of gathering user input. Please note that in order to use the screen without going completely insane, you will need the matching breakout board, as shown in the following image:

The flimsy flexible PCB runner is inserted into the plastic socket on the breakout board – be careful not to crease the PCB nor damage it as it can be rather easy to do so. (The screen can be easy to break as well…) However don’t let that put you off. You will most likely want to solder in some header pins for breadboard use, or sockets to insert wires. For this article it is being used with pins for a breadboard.

Before we start to use the screen, let’s have a quick investigation into how they actually work. Instead of me trying to paraphrase something else, there is a very good explanation in the manufacturer’s data sheet. So please read the data sheet then return. Theoretically we can consider the X and Y axes to be two potentiometers (variable resistors) that can be read with the analogRead() function. So all we need to do is use two analog inputs, one to read the X-axis value and one for the Y-axis value.

However, as always, life isn’t that simple. Although there are only four wires to the screen, the wires’ purpose alters depending on whether we are measuring the X- or Y-axis. Which sounds complex but is not. Using the following example, we can see how it all works.

Example 23.1

In this example, we will read the X- and Y-axis values returned from the touch screen and display them on an LCD module. (Or you could easily send the values to the serial monitor window instead). From a hardware perspective, you will need:

Arduino-ready LCD setup. If you are unsure about using LCDs, please revisit chapter 24 of my tutorials.

Connection of the touch screen to the Arduino board is simple, Arduino analog (yes, analog – more on this later) pins A0 to Y1, A1 to X2, A2 to Y2 and A3 to X1 – as below:

Mounting the rest for demonstration purposes is also a simple job. Hopefully by now you have a test LCD module for easy mounting 🙂

I have mounted the touch screen onto the breadboard with some spare header pins, they hold it in nicely for testing purposes. Also notice that the touch screen has been flipped over, the sensitive side is now facing up. Furthermore, don’t forget to remove the protective plastic coating from the screen before use.

From a software (sketch) perspective we have to do three things – read the X-axis value, the Y-axis value, then display them on the LCD. As we (should) know from the data sheet, to read the X-axis value, we need to set X1 as 5V, X2 as 0V (that is, GND) and read the value from Y2. As described above, we use the analog pins to do this. (You can use analog pins as input/output lines in a similar method to digital pins – more information here. Pin numbering continues from 13, so analog 0 is considered to be pin 14, and so on). In our sketch (below) we have created a function to do this and then return the X-axis value.

The Y-axis reading is generated in the same method, and is quite self-explanatory. The delay in each function is necessary to allow time for the analog I/O pins to adjust to their new roles as inputs or outputs or analog to digital converters. Here is our sketch:

Arduino

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

// Example 23.1

#include <LiquidCrystal.h> // we need this library for the LCD commands

LiquidCrystallcd(12,11,5,4,2,3);// your pins may vary

intx,y=0;

voidsetup()

{

lcd.begin(20,4);// need to specify how many columns and rows are in the LCD unit

lcd.clear();

}

intreadX()// returns the value of the touch screen's X-axis

{

intxr=0;

pinMode(14,INPUT);// A0

pinMode(15,OUTPUT);// A1

pinMode(16,INPUT);// A2

pinMode(17,OUTPUT);// A3

digitalWrite(15,LOW);// set A1 to GND

digitalWrite(17,HIGH);// set A3 as 5V

delay(5);// short delay is required to give the analog pins time to adjust to their new roles

xr=analogRead(0);

returnxr;

}

intreadY()// returns the value of the touch screen's Y-axis

{

intyr=0;

pinMode(14,OUTPUT);// A0

pinMode(15,INPUT);// A1

pinMode(16,OUTPUT);// A2

pinMode(17,INPUT);// A3

digitalWrite(14,LOW);// set A0 to GND

digitalWrite(16,HIGH);// set A2 as 5V

delay(5);// short delay is required to give the analog pins time to adjust to their new roles

yr=analogRead(1);

returnyr;

}

voidloop()

{

lcd.setCursor(0,0);

lcd.print(" x = ");

x=readX();

lcd.print(x,DEC);

y=readY();

lcd.setCursor(0,1);

lcd.print(" y = ");

lcd.print(y,DEC);

delay(200);

}

Next, let’s have a look at this example in action. The numbers on the LCD may be not what you expected…

The accuracy of the screen is not all that great – however first take into account the price of the hardware before being too critical. Note that there are values returned even when the screen is not being pressed, we could perhaps call these “idle values”. Later on you will learn tell your sketch to ignore these values if waiting for user input, as they will note that nothing has been pressed. Furthermore, the extremities of the screen will return odd values, so remember to take this into account when designing bezels or mounting hardware for your screen.

Each touch screen will have different values for each X and Y position, and that is why most consumer hardware with touch screens has calibration functions to improve accuracy. We can now use the X and Y values in sketches to determine which part of the screen is being touched, and act on that touch.

In order to program our sketches to understand which part of the screen is being touched, it will help to create a “map” of the possible values available. You can determine the values using the sketch from example 23.1, then use the returned values as a reference for designing the layout of your touch interface. For example, the following is a map of my touch screen:

Example 23.2

For the next example, I would like to have four “zones” on my touch screen, to use as virtual buttons for various things. The first thing to do is draw a numerical “map” of my touch screen, in order to know the minimum and maximum values for both axes for each zone on the screen:

At this point in the article I must admit to breaking the screen. Upon receiving the new one I remeasured the X and Y points for this example and followed the process for defining the numerical boundaries for each zone is completed by finding average mid-points along the axes and allowing some tolerance for zone boundaries.

Now that the values are known, it is a simple matter of using mathematical comparison and Boolean operators (such as >, <, &&, etc) in a sketch to determine which zone a touch falls into, and to act accordingly. So for this example, we will monitor the screen and display on the LCD screen which area has been pressed. The hardware is identical to example 23.1, and our touch screen map will be the one above. So now we just have to create the sketch.

After reading the values of the touch screen and storing them into variables x and y, a long if…then…else if loop occurs to determine the location of the touch. Upon determining the zone, the sketch calls a function to display the zone type on the LCD. Or if the screen is returning the idle values, the display is cleared. So have a look for yourself with the example sketch:

Arduino

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

// Example 23.2

#include <LiquidCrystal.h> // we need this library for the LCD commands

LiquidCrystallcd(12,11,5,4,2,3);// your pins may vary

intx,y=0;

intd=500;// used for display delay

voidsetup()

{

lcd.begin(20,4);// need to specify how many columns and rows are in the LCD unit

lcd.clear();

}

intreadX()// returns the value of the touch screen's X-axis

{

intxr=0;

pinMode(14,INPUT);// A0

pinMode(15,OUTPUT);// A1

pinMode(16,INPUT);// A2

pinMode(17,OUTPUT);// A3

digitalWrite(15,LOW);// set A1 to GND

digitalWrite(17,HIGH);// set A3 as 5V

delay(5);// short delay is required to give the analog pins time to adjust to their new roles

xr=analogRead(0);

returnxr;

}

intreadY()// returns the value of the touch screen's Y-axis

{

intyr=0;

pinMode(14,OUTPUT);// A0

pinMode(15,INPUT);// A1

pinMode(16,OUTPUT);// A2

pinMode(17,INPUT);// A3

digitalWrite(14,LOW);// set A0 to GND

digitalWrite(16,HIGH);// set A2 as 5V

delay(5);// short delay is required to give the analog pins time to adjust to their new roles

yr=analogRead(1);

returnyr;

}

// the next four functions just display a zone label on the LCD

voiddisplayA()

{

lcd.clear();

lcd.setCursor(0,0);

lcd.print("AAAAAAAAAA");

lcd.setCursor(0,1);

lcd.print("AAAAAAAAAA");

delay(d);

}

voiddisplayB()

{

lcd.clear();

lcd.setCursor(10,0);

lcd.print("BBBBBBBBBB");

lcd.setCursor(10,1);

lcd.print("BBBBBBBBBB");

delay(d);

}

voiddisplayC()

{

lcd.clear();

lcd.setCursor(0,2);

lcd.print("CCCCCCCCCC");

lcd.setCursor(0,3);

lcd.print("CCCCCCCCCC");

delay(d);

}

voiddisplayD()

{

lcd.clear();

lcd.setCursor(10,2);

lcd.print("DDDDDDDDDD");

lcd.setCursor(10,3);

lcd.print("DDDDDDDDDD");

delay(d);

}

voidloop()

{

// get values from touch screen

x=readX();

y=readY();

// now determine where the touch was located on the screen

if(y>510&&x>520&&x<1000&&y<1000)

{

displayA();

}

else

if(y>510&&x<510)

{

displayB();

}

else

if(y<500&&x>520)

{

displayC();

}

else

if(y<500&&x<510)

{

displayD();

}

else

if(x>1000&&y>1000)

{

lcd.clear();

}

}

And see it in operation:

So there you have it, I hope you enjoyed reading this as much as I did writing it. Now you should have the ability to use a touch screen in many situations – you just need to decide how to work with the resulting values from the screen and go from there.

Have fun and keep checking into tronixstuff.com. Why not follow things on twitter, Google+, 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.

Today we are going to examine another small yet useful kit from adafruit industries – their DS1307 Real Time Clock breakout board kit. My purpose of acquiring this kit was to make life easier when prototyping my clock and timer Arduino-based projects on a breadboard. For example, blinky, or the various clock projects in theArduino tutorials.

When breadboarding a DS1307 circuit, there are a few problems – the legs of the crystal are very fine, and break easily, and trying to mount the backup battery holder on the breadboard can be difficult due to their odd pin-spacing. That is why this breakout board is just perfect for breadboarding. Finally, (in Australia anyway) the price of the kit is less than the sum of the retail cost of the parts required. Anyhow, time to get cracking!

Again, as usual the adafruit kit packaging is simple, safe and reusable:

And with regards to the contents within:

… no surprises here, another quality solder-masked, silk-screened PCB that has everything you need to know printed on it. Now that you can see the crystal (above image, bottom-right) you can realise why this board is a good idea. Furthermore, the inclusion of a quality battery and not some yum-cha special is a nice touch.

Assembly is incredibly simple. The IC position is printed on the PCB, the resistors are the same, and the capacitor and crystal are not polarised. Again, no IC socket, but perhaps it is time not to worry about that anymore – my soldering skills have improved somewhat in the last twelve months. Plus the DS1307 can handle 260 degrees Celsius for ten seconds when soldering (according to the data sheet.pdf).

However if you like to read instructions (which is generally a good idea) the excellent documentation is laid out here for your perusal.

Soldering the board is quite straightforward, however when it comes time to solder in the coin cell holder, note that there are large gaps in the mounting holes:

It is important to solder the pins solidly to the PCB, without letting lots of solder flow through the hole and block the other side. If you can bend the pins slightly closer to the circumference of the hole, soldering will be a lot easier. And don’t forget to put a blob of solder on the top-facing pad between the two pin holes before soldering in the coin cell holder.

Finally, when time to solder in the header pins, mount the lot onto a breadboard, and support the gap between the PCB and the breadboard at the opposite end of the PCB. An old CD works very well:

And within ten minutes of starting, we have finished!

Insert the backup cell (writing facing up!) in the holder and you’re ready to time. A new backup cell should last between seven to ten years, so unless you want to reset the clock completely, leave the cell in the board.

Now it is time to use the board. My only experience is with the Arduino-based systems, and even so using the DS1307 can seem quite difficult at the start. However with the right library and some basic reusable sketch modules you can do it quite successfully. The board is a standard DS1307 circuit, and is explained in great detail within the data sheet.pdf.

Don’t forget you can get a nice 1 Hz (or 4, 8 or 32 kHz) square wave from this IC – here is a sketch that allows you to control the square-wave generator:

Arduino

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

/*

DS1307 Square-wave machine

Used to demonstrate the four different square-wave outputs from Maxim DS1307

See page nine of data sheet for more information

John Boxall - tronixstuff.wordpress.com

*/

#include "Wire.h"

#define DS1307_I2C_ADDRESS 0x68 // each I2C object has a unique bus address, the DS1307 is 0x68

voidsetup()

{

Wire.begin();

}

voidsqw1()// set to 1Hz

{

Wire.beginTransmission(DS1307_I2C_ADDRESS);

Wire.send(0x07);// move pointer to SQW address

Wire.send(0x10);// sends 0x10 (hex) 00010000 (binary)

Wire.endTransmission();

}

voidsqw2()// set to 4.096 kHz

{

Wire.beginTransmission(DS1307_I2C_ADDRESS);

Wire.send(0x07);// move pointer to SQW address

Wire.send(0x11);// sends 0x11 (hex) 00010001 (binary)

Wire.endTransmission();

}

voidsqw3()// set to 8.192 kHz

{

Wire.beginTransmission(DS1307_I2C_ADDRESS);

Wire.send(0x07);// move pointer to SQW address

Wire.send(0x12);// sends 0x12 (hex) 00010010 (binary)

Wire.endTransmission();

}

voidsqw4()// set to 32.768 kHz (the crystal frequency)

{

Wire.beginTransmission(DS1307_I2C_ADDRESS);

Wire.send(0x07);// move pointer to SQW address

Wire.send(0x13);// sends 0x13 (hex) 00010011 (binary)

Wire.endTransmission();

}

voidsqwOff()

// turns the SQW off

{

Wire.beginTransmission(DS1307_I2C_ADDRESS);

Wire.send(0x07);// move pointer to SQW address

Wire.send(0x00);// turns the SQW pin off

Wire.endTransmission();

}

voidloop()

{

sqw1();

delay(5000);

sqw2();

delay(5000);

sqw3();

delay(5000);

sqw4();

delay(5000);

sqwOff();

delay(5000);

}

And a video demonstration:

Well I hope you found this review interesting, and helped motivate you to expand your knowledge and work with real-time clocks, Arduino and the I2C bus.

As always, thank you for reading and I look forward to your comments and so on. Furthermore, don’t be shy in pointing out errors or places that could use improvement. Please subscribe using one of the methods at the top-right of this web page to receive updates on new posts. Or join our new Google Group. High resolution images are available on flickr.

[Note – The kit was purchased by myself personally and reviewed without notifying the manufacturer or retailer]