Sunrise Word Clock – Circuit Design v1
Ok, I’ve finally found time to make a new post about my Sunrise Word Clock. My previous attempt at making the circuit work on breadboard didn’t go so well. I assume this is because of the poor connections that the breadboard provides and could also have been because of poor layout choices. Anyway, I’ve rebuilt my prototype on strip board and i’m going to try and explain the circuit here.
The microcontrollers that i have readily available are PIC16F887. These come in a 40 pin DIP package
The interfaces i require are:
- 2 I2C pins
- 2 Vdd pins
- 2 Vss pins
- 3 programming pins
- 1 pin for analogue to digital
- 4 pins for button inputs
- 6 pins for LCD interface
- 22 pins for the Front LEDs
- 1 PWM Power LED Channel
- 2 Crystal Pins
Total pins required = 45… oh dear
45 pins…. that means one PIC16f887 isn’t enough. I either need a simple way to reduce the number of pins, a higher pin PIC or two PICs.
Reducing the pins required – There are a few ways to reduce the required pin count. I could multiplex the front LEDs, reducing the required number of pins for this to 10, however this would make dimming them while maintaining a full range of brightness tricky, plus i’d also like to add a few extra features if possible (status LEDs, 4 extra minute LEDs, extra channel for power LED PWM) so i scrapped the idea of reducing the PIN requirement below 40.
Higher pin microcontroller – The next option was to use a higher pin PIC but the largest through hole PIC is the one i have and surface mount manufacture is a little beyond my kitchen table fabrication options (for now at least).
Using a 2nd PIC – So this leaves me with the final option, using an extra PIC. I’m already using I²C to communicate to the clock chip so why not add a slave PIC to control the front LED channels? Not only is this a solution i can try now, its one that should be a useful learning experience. I like the challenge of programming a slave device.
So i started building. The circuit is based around 2 Microchip PIC16F887 microcontrollers. I have drawn up a nice schematic below:
The MOSFET circuit in the red box will be repeated for pins 3 to 10, 13 to 17, 19, 20 and 33 to 38 to give me 22 switched LED channels. The front LEDs will be powered directly from a 3v source (can’t be bothered soldering 100 limiting resistors, should be fine) and everything else will be powered from 5v.
This is the basic circuit. I’m yet to add all the mosfets for the LED switching, the real time clock and the light dependant resistor but i do have both microcontrollers working. The master is on the right and the slave is on the left. In the bottom right is the header for connecting to the LCD, which i’m currently working on. I’ll be sure to post my code.
I’m going to develop this in stages, each with its own post. The stages required are:
- Using the LCD display
- reading and tuning the A/D converter
- Setting and reading the real time clock
- Implementing software PWM on the slave
- Communicating between the master and slave chips using I²C
I will probably redesign this using a higher pin surface mount chip with built in clock at some point but for now, i want to get building. My next post will be on using the LCD.