This PCB represents two firsts for me – first 4 layer board and first BGA package. The former isn’t really a big deal and is really just necessary because of the latter. Due to my memory requirements, I was forced to use the Lattice iCE40HX8k which has more RAM than the smaller variant, iCE40HX4k, and also only comes in BGA packages.
I haven’t posted in a long time. For one thing, work has been busy. Also I have been making progress here and there in a number of ways, none of which directly merit an article. My solution is to briefly sum up all of my progress here.
It’s been a long time since I last updated about this project, but I have been working slowly in the background. The current plan is to use a TVP7002 from Texas Instruments which is a triple 10-bit video digitiser. It is a little bit over-kill for my needs – it is able to handle three RGB video signals and I only need one monochrome video signal – but nonetheless it is an interesting chip and will achieve what I need.
Last weekend I went to a meetup which was a bit like a hackathon. The title was ‘Multispectral Imaging with Raspberry Pi’. In a lot of ways I am not a fan of the Raspberry Pi – I feel that it was hyped as a great way to get kids into programming, but in reality most kids have access to full Windows PCs which they will be more familiar with and also have much more user friendly programming IDEs, tutorials etc. What interested me was the multispectral imaging, so I went along not sure what to expect.
They introduced the concept of the Normalised Difference Vegetation Index (NDVI). This is a value indicates the health of plant life and calculate by measuring the light reflected by a plant. It is defined as:
Quick Intro to I2C
Along with USART and SPI, I2C is definitely the most common interface used by a microcontroller to communicate with peripherals. In order to implement an I2C bus all you need is two open-collector collector pins, one for the SCL (clock) line and one for the SDA (data) line. It has to be open-collector because there are times during the protocol when two devices drive the clock line at the same time which can lead to a short circuit if one device drives it high and one drives it low. This way, the bus lines are high by default due to the pull up resistors – if a device wants a line to go low, it just shorts it to ground via an internal transistor. There is no path from VCC to GND that does not contain a high-valued resistor.
I bought a set of Philips Hue White Personal Wireless Lighting LED Starter Kit on eBay which were listed as “untested” (just another way to say broken). These, when working, allow you to control the brightness of your lights via the internet from your phone. Being broken, I bought for a fraction of the cost. Now all I had to do was fix them.
Throughout this project, I have been saying that the oscillator I am using, the DS32kHz, is accurate to 7.5 parts per million, or 4 minutes per year. Having run the clock continuously for about 3 weeks now I would expect the clock to have drifted by approximately 14 seconds. However, measuring the clock against the clock on my phone I have found that it has drifted by approximately only two seconds.
Playing guitar and electronics have been two of my favourite things for a long time now. When I was about 14, I combined these two for the first time and built a pretty simply 32W amplifier. While the design is super simple, it actually has a really nice clean tone and does not distort the sound at all. It’s capable of diving an 8 ohm or 4 ohm load. Today I decided to give it a bit of a clean and check if it still worked.
The clock is controlled by an ATTiny87 which has three main jobs:
- Counting the pulses from the Maxim DS32kHz
- Controlling the display via the shift registers (read more)
- Interacting with the user via the reed switches to produce a user interface
Each of these jobs will be discussed separately below as well as the main code to bring it all together in a power efficient way. Full code can be found at my GitHub.
The Amazon Echo Dot is a popular home voice assistant, often trusted to control heating, lighting, music and even door locks. Personally, I use mine for trivial tasks such as controlling Spotify and setting alarms but you can see that it would make an obvious target for an attack.