Several projects on this page make use of a microcontroller, or can be combined with a microcontroller. There are many options to make a microcontroller board in case an existing platform is not preferred. The easiest way to minimise a microcontroller board is to take the processor that is used on the Arduino, and mount it on an experimentation PCB. In that case, the development tools are still the low-threshold Arduino tools.
There are several options to implement the clock, like an on-chip option, but to remain Arduino-compatible, we prefer the external clock by means of a 16MHz crystal and two capacitors. In addition, for Arduino compatibility, we must have
The minimally required hardware is shown in figure 1 and available below as an Eagle3) schematic file. This set-up can be found in other tutorials as well4). Alternatively, this can be done on a breadboard5).
The photograph in figure 1 shows an example of an ATmega328P solution on an experimentation board which uses a 3V battery (clip on the lower right) and a small buzzer. You can clearly see the 16MHz crystal.
To set the fuses and to burn the bootloader conform the Arduino platform it is advised to use te Arduino environment. This can be done with a dedicated programmer or with a second Arduino board:
Uploading programs (“sketches”)
When all Arduino compatibility measures are taken into account (external clock, Arduino bootloader), we can place any ATmega328P processor on the board which is uploaded with an Arduino sketch. So, we can upload a sketch to a microcontroller on a regular Arduino board, and next move the processor physically form the Arduino board to our own simplified board. In this way, we avoid the need of implementing a full USB communication interface or ICSP socket.
In general, sensor applications may need one of two embedded software front-ends:
For both problems, there are examples given on the read-out pulses with a microcontroller page.
The Arduino 2009 board consumes typically $25mA$ at $5V$ and $16MHz$, of which $50\%$ in FTDI chip and $50\%$ in the ATmega328P processor. Consider a $9V$ block battery which has a capacity of $500mAh$. With $25mA$ current, this means a plain Arduino board at work survives for $20hrs$ with this battery.
However, there are two power-saving options based on hardware that can be implemented easily to extend the battery life. First of all, reducing the supply voltage reduces the consumed power. Next, reducing the clock freuqnecy reduces the power. In <ref ATMEGA_Power>, which comes from the Atmel ATmega328P datasheet11), we can see the operational point effect of reducing the supply voltage and clock frequency. When going from $5V$ to $3V$, and from $16MHz$ to $10MHz$, the ATmega current reduces from $10mA$ to $4mA$. This gives the opportunity to use a $3V$ battery of type CR2032H (capacity $240mAh$), and increases the life time to over three days. A consequence is that when programming the Arduino, all clock rates reduce with $10/16$ which includes the communication baud rate as well.