PIC18F light sensing device

New micro projects

By admin, April 27, 2015

Several new microcontroller projects expand knowledge into new areas…

I’m currently working on several microcontroller developments projects for myself and others.

Let There Be Light!

The first project involves minimal hardware, but uses a PIC18F chip to monitor a Panasonic visible light sensor and make relatively educated deductions about ambient conditions based on just that information. I don’t want to reveal too much else, as a friend and I are probably going to file a patent application for this product. Let’s call it “sort of an occupancy sensor”.

PICkit Low Pin Count Demo Board

PICkit Low Pin Count Demo Board is a great starting point

This is really the first time I’ve worked with a “micropower” solution. The PIC chip can enter a very low power “sleep” state and be woken by the light sensor exceeding a fixed comparator value, a button press, or a watchdog timer to perform periodic system checks. Our goal is to have the product work for several years on just two lithium AA batteries. It looks like it is feasible!

Microchip’s “PICkit low pin count demo board” has come in really handy for this and other projects recently. I love that you can just plug it into an In Circuit Debugger and start coding with no other hardware necessary, adding hardware bits as they evolve. And they are inexpensive!

And Let There Be Motion Too!

The second project uses the same PIC18F chip with a bit more hardware, including a Honeywell HMC5883L electronic magnetometer acting as a 3-axis compass. It’s been a bit of adventure doing arctan() calculations with the limited memory and processor speed of the PIC18F. Experiments are ongoing; I might bump up to a 20-pin PIC24 device for more horsepower, especially if I use data from all 3 axes.

This project is intended to monitor motion of a vehicle and control LED lighting. Although this is probably not a patentable product, I’m not giving away too many details. I already have a party quite excited in distributing a finished product based on this concept!

PIC18F compass

PIC microcontroller board stack using Honeywell electronic compass

PIC18F compass project

Second board has protected high-side drivers for multiple LED channels

The readily available Honeywell chip uses an I2C serial interface, which I pretty much dislike. I will probably switch to the SPI version in a final product. I2C seems way too non-deterministic to me, and its bi-directional signalling is a pain when level translation is required (the compass is limited to about 3.3 volts). It just seems like a kludge.