Author Topic: PIC Project 16f887 - Binary Clock  (Read 16621 times)

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
PIC Project 16f887 - Binary Clock
« on: February 12, 2010, 06:36:32 PM »
I`ve been working on this code on and off for the last few weeks. Finally got it running on breadboard a few hours ago thanks to my good friend who helped me point out my errors in the circuit. This may have some machining now as I have a case to build!

Part 1 at least:




Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: PIC Project 16f887 - Binary Clock
« Reply #1 on: February 14, 2010, 03:50:11 PM »
Aluminium housing for the binary clock....






Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: PIC Project 16f887 - Binary Clock
« Reply #2 on: February 15, 2010, 04:59:04 PM »
A start on the circuit:





Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: PIC Project 16f887 - Binary Clock
« Reply #3 on: February 15, 2010, 07:10:17 PM »
Looking good  :thumbup:

Are you planning to hollow out the aluminium to contain the circuit?
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: PIC Project 16f887 - Binary Clock
« Reply #4 on: February 16, 2010, 06:49:13 AM »
Hi, thanks for the interest. I want to make this board on PCB which is my next project - building a UV exposure unit and then I had thought about what you suggested - hollow out the ally back and put the circuit the there.. I doubt I could reduce it small enough to fit into the housing but yes I have thought about it and that would be my aim. For now I would just like to get it running so I`m going to cobble together an ugly circuit to wire the unit up and have it running. The 25 leds are problematic in terms of the mess of wiring without pcb.

Thanks
Chris

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: PIC Project 16f887 - Binary Clock
« Reply #5 on: February 16, 2010, 07:48:45 AM »
Homebrew PCBs.... now that's interesting stuff. I've looked a few times at the various kits that are available, but I've always been put off by not actually having a specific project to do. As it happens, I have a large MicroMat PCB drilling rig here at the shed, but it's in a state of some dilapidation, and hasn't been used in many years (at least 10). It's tempting to try to make it work again, as it would make a dandy CNC router; and, of course, well able to drill PCBs...

I know what you mean about LEDs; personally, I'd have used strip board rather than the plain board you've used; at least you can solder the components directly to some copper then, which allows you to fix everything down & doesn't rely on too many hand-wired connections. For your application, you may want to look at using wire-wrap kit instead of soldering everything? That also gets you out of having to make a PCB...
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: PIC Project 16f887 - Binary Clock
« Reply #6 on: February 18, 2010, 06:51:11 PM »
Hi AdeV - thanks for the info. I have got some strip board but I`ve got it in my head that I want to try a PCB via photosensitive PCB and etching. The UV LEDs to make a UV exposure box, x200, 395-400nm, 3000mdc are on their way from China as we speak.  :ddb: :ddb: Infact, I`ve been waiting for a week now so hopefully within the next week or so they will be here and then it is time to start. I`ve ordered 200 as I said and talking to my mate, I think it will be best if I stuff all 200 onto one board and have them quite intense so there is plenty of overlap and hopefully a fairly even lighting. I was going to run them off a laptop charger, 19v, 3A in strings of about 4. I am in the process of making a box and I`ve even started programming a PIC using my binary clock code to make a timer however I mislead myself into thinking that turning them on via the PIC was going to be a very straight forward affair. Apparently it is, with some darlington transistors (on order as well) but I`m not so sure! I`m still learning and I`m taking it in as quick as possible but the electronics is lagging behind the progression in my coding!

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: PIC Project 16f887 - Binary Clock
« Reply #7 on: February 18, 2010, 07:00:41 PM »
Hi AdeV - thanks for the info. I have got some strip board but I`ve got it in my head that I want to try a PCB via photosensitive PCB and etching.

Quite right too, it's the MadModder way  :dremel:  :nrocks:

Quote
The UV LEDs to make a UV exposure box, x200, 395-400nm, 3000mdc are on their way from China as we speak.  :ddb: :ddb: Infact, I`ve been waiting for a week now so hopefully within the next week or so they will be here and then it is time to start. I`ve ordered 200 as I said and talking to my mate, I think it will be best if I stuff all 200 onto one board and have them quite intense so there is plenty of overlap and hopefully a fairly even lighting. I was going to run them off a laptop charger, 19v, 3A in strings of about 4. I am in the process of making a box and I`ve even started programming a PIC using my binary clock code to make a timer however I mislead myself into thinking that turning them on via the PIC was going to be a very straight forward affair. Apparently it is, with some darlington transistors (on order as well) but I`m not so sure! I`m still learning and I`m taking it in as quick as possible but the electronics is lagging behind the progression in my coding!

Yeah, my electronics skills are a bit feeble too, although I'm trying to learn (as well as learning to machine, to weld, embedded processors, car suspension design... must be an age thing). However, rather than a PIC timer, I wonder if it wouldn't be easier to just make a dead simple 555-based timer with a calibrated potentiometer? Hmm, maybe not madmodderish enough ;)

For switching, consider using a relay (nice click-click effect, saves you adding a speaker & some extra code!); got to be easier than fiddling with high-power transistors?
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: PIC Project 16f887 - Binary Clock
« Reply #8 on: February 18, 2010, 07:16:24 PM »
AdeV - your probably right about the 555timer but I don`t have a single clue about them, I`ve heard about them and seen books purely based on circuits involving them but not any idea how they run. The beauty of the PIC is that I can get a bit of code creep in there and since I already have a clock based code I`ve wrote, it is a very straight forward adaptation to make it function as a timer. With a keypad and lcd I could even have it running so that you input and exact time length with a display showing how long is left.

Regarding the relay, that was the route I first took but then found out that it then involved transistors and diodes to actually turn the relay or your in risk of blowing up the PIC! I believe using TIP120 darlington transistor  I`ll only need a small resistor between the pic and the TIP120 and it will be fairly straight forward.

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: PIC Project 16f887 - Binary Clock
« Reply #9 on: February 18, 2010, 07:24:50 PM »
AdeV - your probably right about the 555timer but I don`t have a single clue about them, I`ve heard about them and seen books purely based on circuits involving them but not any idea how they run.

555's are wonderfully simple - it would be worth getting to know them a little, even if you don't use them very often. I believe the technical term is, they are an astable multivibrator - which, as far as I can tell, just means it flips states continuously. You set the timing with a simple capacitor/resistor combo (one of each - plus a variable resistor if you want variable timing), and that's pretty much all there is to it. Maybe a reset button too, and an on/off switch...

Quote
The beauty of the PIC is that I can get a bit of code creep in there and since I already have a clock based code I`ve wrote, it is a very straight forward adaptation to make it function as a timer. With a keypad and lcd I could even have it running so that you input and exact time length with a display showing how long is left.

I hear you there. Although I've not done any more experimenting with my Arduino of late, I was seriously impressed with it when I was playing. I'm sure the PIC is pretty similar.

Quote
Regarding the relay, that was the route I first took but then found out that it then involved transistors and diodes to actually turn the relay or your in risk of blowing up the PIC! I believe using TIP120 darlington transistor  I`ll only need a small resistor between the pic and the TIP120 and it will be fairly straight forward.

Hmm - you should be able to get a 5v DC relay which will drive directly from the PIC. You do need the diode in parallel with the relay to prevent back EMF from frying the PIC when the relay is deactivated; a transistor would make for an additional safety net, but shouldn't be a requirement...

That said, once you've got the transistor in there, it may as well replace the relay! Just don't forget the clicker... (speaker on a PWM output should be fine)  :)

Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline andyf

  • In Memoriam
  • Hero Member
  • *****
  • Posts: 1795
  • Country: gb
    • The Warco WM180 Lathe - Modifications
Re: PIC Project 16f887 - Binary Clock
« Reply #10 on: February 18, 2010, 07:34:14 PM »
Ade, I've made plenty of PCBs on UV sensitive board by drawing up the circuit in MS Paint, then printing out on to transparent film. It takes a bit of experimentation to find how many pixels there are to the inch, and you have to remember to place the film on the board the right way up to get the view from the copper side rather than the component side. Indeed, some say that plain thin white printer paper lets enough light through. In either case it's better to have the printed side next to the copper, to avoid light leakage and blurry edges. I use a wooden box containing a 12" UV fluorescent tube from Maplins, with a tight-fitting wooden lid to keep the UV away from my eyes. The box is lined with crumpled kitchen foil as a crude reflector/diffuser.

But for simple boards, I just use plain (non-UV) PCB painted with nail varnish as an etch resist - it dries quickly, and mistakes can easily be rectified by carefully chipping them away. Nail varnish can be a bit embarrassing to buy, though.

Andy
Sale, Cheshire
I've cut the end off it twice, but it's still too short

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: PIC Project 16f887 - Binary Clock
« Reply #11 on: February 18, 2010, 07:45:12 PM »
Nooo, stop it!


Must resist:  :proj:

Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline raynerd

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2893
  • Country: gb
    • Raynerds Projects - Raynerd.co.uk
Re: PIC Project 16f887 - Binary Clock
« Reply #12 on: February 19, 2010, 03:36:22 AM »
AndyF - did you get your tubes from Maplin in store or maplin online -only I was looking for tubes and couldn`t find an instore supplier, only on line. Then I got drawn into the LED idea and decided to go with that. Thanks for the info Andyf, it was an interesting read. What do you use for the final etch - hydrochloric acid or ferric chloride?

Chris

Offline Fred Bloggs

  • Jr. Member
  • **
  • Posts: 51
Re: PIC Project 16f887 - Binary Clock
« Reply #13 on: February 19, 2010, 04:07:29 AM »
Chris

Quote "What do you use for the final etch - hydrochloric acid or ferric chloride?" Most people do small scale board etching with Ferric chloride , I would have thought that the Hydrochloric acid would have to be very concentrated to etch the boards in a resonable time. Suggest that you use one of the small fish tank heaters to warm the Ferric Chloride up whilst it is etching and gentle aggitate, works alot quicker! You can resuse it quite a few times before its scrap, just be very careful how you dispose of it.

I have got several books (including the Babini series, the ones that maplins sell) on 555 timer circuits, I'll dig them out and post the proper titles and ISBN numbers on this thread if you interested?

Ps interesting stuff with regard to the PIC's, I brought a PIC development kit 10 years ago to do something with an old milling machine then met the SWMBO, kids etc and have yet to get it out of the box, arh well something for me to do next year!! when I finish the house etc etc.

Fred

Offline andyf

  • In Memoriam
  • Hero Member
  • *****
  • Posts: 1795
  • Country: gb
    • The Warco WM180 Lathe - Modifications
Re: PIC Project 16f887 - Binary Clock
« Reply #14 on: February 19, 2010, 04:26:17 AM »
Hi Chris,

I got it in store, but that was years ago. Here's a pic of the unit - glass-topped box, with a foam-lined lid.




As to using nail varnish, here's a pic of a (commercial?) one for a 1980s design from Practical Wireless for a transverter to get a 28MHz transceiver to transmit and receive on the 50MHz amateur band:
http://www.uhf-satcom.com/misc/meon/m0eyt_meon_pcb_bottom.jpg .
When I got round to building it, supplies of the board Practically Wireless produced had run out, so I made my own (it's all boxed up, so no pic of it). Of course, that method would be no good for boards with lots of fine tracks running to ICs.

I have always used ferric chloride for etchant, with latex gloves - apart from its mordant quality, it stains badly, including fingers - looks like you smoke 100 a day.

Andy
Edit:
I don't think the uhf-satcom link works. Never mind - it wasn't terribly interesting.
« Last Edit: February 19, 2010, 04:32:40 AM by andyf »
Sale, Cheshire
I've cut the end off it twice, but it's still too short

Offline Bluechip

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 1513
  • Country: england
  • Derbyshire UK
Re: PIC Project 16f887 - Binary Clock
« Reply #15 on: February 19, 2010, 07:32:35 AM »
Hi Folks

The full list of Babani books is here ... Maplin et al. don't have all titles I think

http://www.babanibooks.com/bb7.htm

Dave BC
I have a few modest talents. Knowing what I'm doing isn't one of them.