I haven’t really written about things for a while, so here’s a little update on what I’m up to. Essentially I spent some quality time with KiCad and made some more PCBs. I was going to go through the code for the conference mood badge and talk about what I’ve learnt about optimisation of code on AVR platforms, but on reflection other people have done that on much better ways. It’s all fairly standard C optimisation stuff mixed in with some tips on getting the most out of the architecture. My favourite trick was using an unused register as a counter, but there were lots of other tips on code syntax and refactoring which saved lots of bytes. Google around for that stuff.
Anyway, first thing to talk about: I took my little LED matrix board that I made and turned it into a standalone PCB. I’m still really addicted to designing PCBs to help me learn to solder better and also to just acquire new skills. I’ve learnt so much and I’ve now had 4 different designs fabricated. One of those was a commission from a friend, and I’ll get onto that perhaps in another post. But this was just a way of making a standalone Arduino-derived project with power regulation etc. The concept is simple but after doing this I can use the same layout for other projects. I actually used an ATMega328p microcontroller, the same chip as used in the Arduino Uno, a crystal for a clock, added some voltage input and regulation, and connected the LEDs and resistors too. I am a little annoyed I didn’t put any buttons on this, as it would enable it to be hacked to perhaps play a game or input new data. One idea for a V2, perhaps... The second board was this rather intricate snowflake design which I honestly thought I’d get emailed about by JLCPCB to ask what the fuck I thought I was doing. The idea is that some LEDs are on permanently and some flicker in a random pattern, like a twinkling effect. The idea is absolutely a rip off of this version on the Arduino website, only this is through-hole and not surface-mount. The code is roughly the same as that one, but I may add some more patterns and cycle through them. The microcontroller can be as small as an ATTiny13, the code is that tiny. Since starting my electronics journey I’ve hated using ATTiny85s for projects that don’t require them, and the 13s are a tad cheaper.I put together the LED Matrix and instantly was met with one duff light. I accidentally trashed the pads while changing it out, so I guess it’s just going to have to stay missing. Now, I thought I’d flashed a correct bit of code to the chip in the board, but it didn’t seem to work as expected. I honestly spent an entire day wondering if it was a hardware error and then also ended up sticking a second-long delay between lighting up each light and it worked. All of that time I thought the board was stuck in reset and I wasted so many hours. I’d changed the code between testing the layout with the prototype and having the PCB fabbed and got all the pin assignments wrong. Ugh.
So yeah, let that be a lesson for everyone. But look! It works!
The third board, which I’ll write up in another post was a controller board for an ambient light setup around a monitor, using the WS2812b light strips everyone loves. I asked my friends if anyone needed a board making and one of them said that he had a lashed together setup with wires twisted together and hanging off the back of the monitor. So I made a distribution board for the power and data connections. The process was challenging and I had to consider things I hadn’t thought about before, such as the heat dissipation and the widths of the traces.I'll go through all of that soon!
Comments
Post a Comment