User Tools

Site Tools


projects:advent

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
projects:advent [2016-02-01 17:21]
robert created
projects:advent [2016-02-10 17:11]
robert [Firmware]
Line 40: Line 40:
  
 ====Circuit==== ====Circuit====
-Coming soon.+The circuit used is embarrassingly simple: Each LED is powered from the USB supply, driven by a ULN2003, and has its current limited by a trimmpotThere is one GPIO pin for each LED, so no fancy multiplexing or anything clever.  
 + 
 + 
 +{{ :​projects:​advent-driver.png?​direct&​400 |}} 
 +<WRAP centeralign>​ 
 +//LED driver schematic. There are 24 of these.// 
 +</​WRAP>​ 
 + 
 +There are a few reasons why this rather inelegant and simple driving method was chosen: 
 +  * Despite the large number of components, it was actually fairly quick to build 
 +  * Having one trimmer per LED allows to set the current reasonably accurately to balance brightness 
 +  * Without multiplexing,​ the LEDs can be easily driven with a PWM waveform. 
 + 
 +The resistor values for the trimmers were calculated beforehand to get a rough idea of the values required to equalise the perceived brightness of all LEDs. However, as one would imagine, there was quite a bit of tweaking involved in the end to get everything looking just right - and unfortunately I ran out of trimmers of the same style and had to resort to a few even crustier ones from my box. 
 + 
 +Apart from that, literally the only other components on the board are a pushbutton switch with a pull-up resistor and a CR2032 for the battery-backed RTC of the mbed.  
 + 
 + 
 +{{ :​projects:​advent-rest.png?​direct&​400 |}} 
 +<WRAP centeralign>​ 
 +//​Boring.//​ 
 +</​WRAP>​
  
 {{ :​projects:​advent-overview.jpg?​direct&​400 |}} {{ :​projects:​advent-overview.jpg?​direct&​400 |}}
Line 49: Line 70:
  
 ====Firmware==== ====Firmware====
-Coming ​soon.+Like the hardware, the firmware is really quite simple - It primarily consists of a state machine that deals with the switch input and turns on LEDs accordingly. The current number of LEDs that are on, and the sequence in which the LEDs turn on are kept in files on the mbed's embedded flash (accessible through the mass storage device).  
 + 
 +One of the very few aspects of note about the firmware is the bit-bang PWM: When an LED turns on, it fades in slowly over a second or so. Since the mbed doesn'​t have 24 PWM channels and the LEDs aren't multiplexed,​ I had to implement a software PWM generator. This will works on any one pin at a time and is reasonably accurate and stable because the state machine is clocked and the time taken to execute it is fairly constant. The fade-in of the LEDs follows a quadratic duty cycle in order to get a perceived linear (well, close enough) fading effect. Again, thanks to the computing power provided by the mbed this task did not even pose a remote challenge. 
 + 
 +<WRAP center round info 60%> 
 +Github repo coming ​soon. 
 +</​WRAP>​ 
projects/advent.txt · Last modified: 2016-02-10 17:14 by robert