Multispectral Imaging with Raspberry Pi

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:

{\displaystyle {\mbox{NDVI}}={\frac {({\mbox{NIR}}-{\mbox{Red}})}{({\mbox{NIR}}+{\mbox{Red}})}}}

Continue reading “Multispectral Imaging with Raspberry Pi”

Advertisements

The Atmel’s Universal Serial Interface (USI) sucks for I2C

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.

Continue reading “The Atmel’s Universal Serial Interface (USI) sucks for I2C”

An Intuitive Derivation/Proof of the Sum of an Infinite Geometric Series based on Zeno’s Paradox

A geometric series is a series of numbers where each number in the series is equal to the previous number multiplied by a constant multiplication factor. For example: 2, 4, 6, 8, 16… is a geometric series with a constant multiplication factor of 2.

The sum to infinity of such a sequence, then, can be represented as:

Continue reading “An Intuitive Derivation/Proof of the Sum of an Infinite Geometric Series based on Zeno’s Paradox”

WordPress.com Stats Scraper

Something that has been annoying me for a while is that there is no way to download your WordPress.com stats from the website!

So I wrote a script in python to allow you to download all of your stats into a spreadsheet. Here is the guide.

Basically, you need to provide the script with an example XML Http Request (XHR) where the website is pulling stats data from the WordPress.com server. From this XHR, the script then reconstructs a new XHR to get all of the data.

Soft Switching – Reverse engineering the LCR45

Soft switching allows a single button to be used as both an input and a power button. An example of this is the LCR45 LCR meter from Peak Electonic Design which has two buttons – on/menu and enter/off. As you can tell from the names, both buttons operate to turn the device on/off and also trigger the menu and enter functions in the interface.

This could be achieved by using both buttons only as inputs to the processor (a PIC in this case) and never turning the chip off, simply putting it into low power mode and using the ‘on’ button to wake it from this sleep. But even the best low power mode uses more power than actually turning the device off and the battery would eventually drain. So how can we achieve a multipurpose button and still use no power when turned off? To answer this I reverse engineered the LCR45 and drew out the circuit which I will now explain.

Continue reading “Soft Switching – Reverse engineering the LCR45”

Hackathon: PAL – Proximity Alert Locator

Yesterday, I had just got back from campus and was just enjoying a coffee before I got down to work when I got a message from a friend:

13184582_986676191401345_469028818_o.jpg

“…come and build stuff…”

There was an event on campus called “Make Cool ShMIT – again!”, where they provide a bunch of components and (more importantly) pizza, and you build something in teams for 2 hours. I decided that work could wait and hopped on the bus to campus.

Continue reading “Hackathon: PAL – Proximity Alert Locator”