Output Devices

Jump to the hero-shot

Measuring power consumption

The idea to measure how much current your project consumes is needed to calculate the overall power consumption and/or the time it will be powered with a battery.

I found this useful tutorial about how to measure the current consumption of your project. Then with that value and the voltage you can calculate the electric power following the next formula P=VI

I use a multimeter to measure the current consumption of my CharlieTree to calculate the time it will last on batteries. Without animation it took a max of 20mA, when the animation was On the value was variant but always lower than 20mA.

The idea is to power it from two AA batteries that have about 2000 to 3000 mAh of capacity, using two I will get a total capacity of 4000 mAh divided for the consumption of 20mA I will have 200 hours of constantly turned On light.

As I intended to program the animations to be active for 30 minutes and then enter sleep mode on the ATtiny45, until the next night it will give me a 400 night circles, more than a year of working.




Group assignment!

The idea was to measure and understand the current consumption of an output device and why you should care about.

See out group page!


Designing the board and 'screen'

I decided to use this assignment to create a 'screen' or user interface that will be used on my final project, the idea is that some back lighted icons an 7 segments display, hidden behind a this veneer wood, will give the user feedback about the state of the machine and some basic configuration.

When I was planning how to make this board, I found that all the 'small' (ATtiny family) microcontrollers that I may use for the display were out of stock on the lab, Roberto my instructor suggested the ATmega328p. I then design a board that will, hopefully, the main board of my final project. It will drive the 'display' and also the water pump and the LED strip. and be capable of interfacing with some external sensors.

ATmega328p schematic

Main schematic of the board, how the ATmega328p is connected to other modules.

7 segment schematic

Module of the icons and touch sensors

Icons and touch sensors schematic

Module of the icons and touch sensors, counted as a 5th digit for multiplexing.

Serial communication ports

Module that manages serial communication, note there is an error here, see the update

Power and load modules

Modules that manage the H bride and mosfet.

Boards created from the schematic

I created two boards that will be connected by a ribbone cable, as one needed to be placed vertical and the other is located on top of the project.

The routing of the main board was a bit difficult and I also put the 7 segments display on the back side of th board so it will fit the position on the final project assembly. I also have to use some jumper wires that are represented as straight traces on the bottom layer.

User interface board

User interface board, contains the led icons and the touch sensors.

Main Board

Main board, contains 7 segment, serial, power, and power outputs modules. Note is now updated below


Update!

The previous schematic and board were missing 1MΩ resistors for the touch sensors, I have fabricated a new one, that features those changes, the design files are now updated.

Updated schematic

Updated schematic it now contains 1MΩ resistors for the Rx pin of each button

Updated board design

Updated board design, note it now contains 1MΩ resistors and is routed different


Design files updated





CharlieTree, designing a board for charlieplexing

I embedded some LED's on the tree I design for the molding and casting week, they were connected on a 6 led 3 wire charlieplexed matrix, the idea is to have a night lamp that will animate the brightness of each led and then turn off, it should be powered by batteries and have a lower power consumption so it will last long without needing a change.

CharlieTree schematic CharlieTree Board

Simple board and schematic, it includes a push button as wake up button and animation configuration, also wire pads for the 3 LED lines and battery cables.

Get the .sch file! Get the .brd file! See how it was programmed!

The fabrication processes

Also for this week I created a 6 icon panel that will be back lighted trough veneer wood. My idea to test was to laser cut the icons on 3mm mdf and then shine the led's trough that.

The vinyl cutting process was made using a Cameo3 and the Silhouette software I use the preset for aluminum foil and then turn the speed down to 5. Use two passes to ensure that the tape was cut. My first attempt was to paste the tape to the cutting board and use transfer paper to pase it to MDF. But the adhesion to the cutting board was harder that the transfer so it wound come out and it broke on mid presses.

The second attempt was to place the raw tape and then paste it to the MDF, this work like a charm, I also use transfer paper to get it on the right place without any problem.

Capacitive sensors End result of the user panel with touch sensors

After soldering to the user panel board and stuffing the back with LED's I turn them on to test. On my final project I intended to use a thin layer of wood veneer to cover the panel. I use some tjick paper to test it.

connection cables to sensors Icon display working

Milling

Main board milling process

On this week I also milled the 3 boards, one for the charlieplexing tree, the user panel and the main board. The methods used were the same send on previous weeks. I took me a long time to get the settings right, also the machine was randomly stopping on the middle of the job. maybe the .nc file generated by mods was the problem.

The smaller board for the CharlieTree was made using mods, for the other two boards I use a ULP to export to g code direct form Eagle. This was recommended by Diego from the lab. This option works without problem but I' not able to change any setting, luckily the default ones work well.

The next step was to stuff the boards, I did it at home, this is getting easier each time. The User Panel and CharlieTree boards were easily made and stuffed.

The main board was delayed because I needed to drill the holes for the trough hole components, but then I found the missing 1MΩ resistor, so I redesign that board after finally stuffing it. The ATmega328p chip was the most challenging part as it has 32 pins and smaller pad clearance.

Main board milling process

Drills made to solder the 7 Segment display on the bottom of the board.

Main board milling process

The bottom layer traces were made using rigid wires as vias and traces.

Programming

Main board test code

The idea was to test the hardware of the main board to ensure that it can be used on the final project, I started by setting up code to make the actual multiplexing of the 7 segment digits. 4 are the actual 'clock display and the 5th are the icons. Using and timer interrupt I light up the corresponding number on each digit based on an array. This make the main loop free to other applications like sensing and polling data from the sensors.

The first thing was to drive the 7 segment digits, I use direct port manipulation, and a ISR with 128 prescaler. Then I created my own 'library' to handle the touch button, the idea is ro represent each one as an object width unique threshold and the ability to auto calibrate to ambient capacity. I use the Arduino serial plotter to help me debug.

Serial plotter while debugging

The threshold is a filter signal with very slow response and a unique offset that can be positive or negative. A touch is detected when the signal pass the threshold.

filt = (1-eps)*filt + eps*value;
thershold = filt + _touch_threshold;

I use this formula as filter, eps is the change rate I use a very small value (0.005), _touch_threshold can be defined while creating the object

See the main.board.c code See the TouchBtn.h code See the TouchBtn.cpp code See the Makefile



CharlieTree code!

For programming the CharlieTree I use VS-code as IDE, with .c and Make file, mapped to the build task that will complied and upload to the ATtiny45 on the board.

For the multiplexing and the animations I needed to have the main loop running, so I use the Counter/Times to make interrupts (ISR functions), one is used to do the actual multiplexing, and PWM on the matrix. By displaying the brightness of each LED based on an array.

#define CH_PLEX_PORT PORTB
#define CH_PLEX_DIR DDRB
#define setHigh(pin) (CH_PLEX_DIR |= pin ); (CH_PLEX_PORT |= pin )
#define setLow(pin) (CH_PLEX_DIR |= pin ); (CH_PLEX_PORT &= (~pin) )

I come up with this functions that help me to charlieplex the idea is to turn all pins to inputs and the set as output and the value with this functions to address each led.

See the .c file See the Makefile file See the result!

Troubleshooting

The major trouble I found this week is that I forget about the 1MΩ resistors needed for the TxRx step sensor method, so I have to redesign and make the main board.

I also wire up the touch sensors wrong and the common tx was actually one of the buttons what causes to detect useless data. after disordering and apply new solder all was fixed.

Then I have to change the direction of the icons to match up with the common cathode 7 segment displays that I bought, also sadly all digits were labeled as red but 2 are orange which is actually a nicer color.

Results!

CharlieTree

CharlieTree turned On

User panel

Icon display mounted on the main board Icon display

Main board

Main Board stuffed top side Main Board stuffed bottom side
Main board working

Video of the touch test and appropriate response on the screen, the idea is that you can set each digit value, using the arrows and the mid button to change digit

Conclusions

This was a very intense week, but I think that the fact that I tackle down the main board design was helpful for my project as it is intended to be the central bone of the electronics embedded. More tests and programing needed to be done yet but it seems ok.

There is a lot of options to 'output' form your project, I like the idea of thinking that this is only one light pass over the contents and I will explore more on the future, I'm very happy with the final look of the CharlieTree.

Have I?


Prev Next