12. Output devices¶
Individual assignment :
- add an output device to a microcontroller board you’ve designed,
- and program it to do something
Group assignment :
- measure the power consumption of an output device
I want to use a 10 LEDs bargraph display because I think it is the most explicit way to show if you are getting out of range :
I bought it on eBay for less than 1€/pcs. If you want to do it yourself, you just need 10 LEDs.
To control it, I will make a board with a LM3914 driver (but it can be replaced with LM3915 or LM3916).
I designed two boards in EAGLE :
The small one is for connecting the bargraph module with a single-row header. The second is for the LM3914 driver.
These board are meant to be connected at a right-angle, so I can place many displays on a front panel without having to care about the width of the PCB.
Here is the schematic :
There are a lot of open contacts and the display is not acting as expected :
And the schematic, that was inspired from the LM3914 datasheet, is not suitable for the settings that I want to do. So I started a second circuit…
This circuit is inspired from this website (in French, this is where I learned electronics).
It has the advantage that you can set the upper and lower limits where the LEDs should light up.
Here is the second PCB :
And how it will look like, once milled and assembled :
I exported g-code from EAGLE using the pcb-gcode plugin, but when I selected the Generate bottom outlines, I also selected Mirror (an old habit from UV mask etching). So the circuit was milled mirrored :
I kept the same schematic but I added little improvements to the PCB :
And I milled it without any trouble, except for the holes that were not deep enough :
But it’s ok, I just cleaned it using a scalpel.
Here is the module, soldered and connected to my HelloBoard :
The HelloBoard is controlled from a computer, with a FTDI adapter.
To control the bargraph module with my HelloBoard, I wrote a code to make the ATtiny84 read a byte from the serial port input and use it’s value to set the duty cycle of a PWM output.
The default PWM frequency is quite low and I had to use an analog filter to make it readable for the LM3914. So I tried to increase the PWM frequency to remove the need of an additional filter.
Bargraph module EAGLE schematic and board