Been playing with a free version of the Eagle PCB Design Software today. Have got the schematic nearly done – just missing a couple of resistors and a jumper on pins 5 and 6 of the ATtiny45. This is going to be a replacement for the arduino on a breadboard (well, Adafruit perma-proto) and the ATtiny LDR board that switches on when it’s dark. It seems like a good way to go and I can add extra functionality whilst just having one board to play with, not two.
Here’s the nearly finished schematic:
Most of the action is at the bottom of the schematic. JP1 connects to an LDR (on a wire so it’s not tied to the board and can be put in a sensible place – thanks to ChrisB for that suggestion). There’s also a little pot that is used to set the light level at which the G35 lights get turned on. LED1 is a red/green LED and that’s green for “On”, red for “Off”, off if you’ve hit the timeout (more about that later) and yellow if you’re within some threshold of transitioning between on/off. The “yellow” is acheived by using 2 pins to drive the LED – as long as you toggle them “fast enough” then the human eye sees yellow. The ATtiny is running at 8MHz using it’s internal oscillator, that’s plenty fast enough for this.
The ATtiny45 drives an N-Channel MOSFET which is used to switch the ground for the ATmega328P. The 328 runs the G35 controller software which can manage multiple strings of up to 50 lights. The MOSFET is a tiny Infineon OptiMOS 3 device that can cope with up to 30V/30A – although not at the same time.
To be added is a jumper to optionally short pins 5 and 6 of the tiny45. One will have a weak pulldown to ground (1M Ohm, say) and the other a stronger, but still weak, pullup (10K). When the tiny45 starts up, it reads the pin that should be low. If it’s high, we enter “setup” mode where the number of hours that the lights can stay on is set. This uses (abuses?) the pot and involves flashing the LED to show the number of hours. The value is saved in EEPROM and on a normal start (i.e. the pin stays low) then as soon as the lights switch on due to it being dark enough, the clock starts running and they get turned off after the preset number of hours.
Have also had a quick play with trying to do a board layout in EAGLE for this. Not much success so far – guess I’ll have to look at some of the excellent tutorials out there again. The aim is to get 2 layer boards made by SeeedStudio’s PCB Service – at $9.90 for 10 5x5cm boards, what’s not to like 🙂
I’ve found the rpcelectronics tutorials to be pretty good. There’s plenty of others out there though so may try some more. I obviously have more to learn.
I’ll follow this up with links to the design files, software etc. once I get it a bit more advanced.