If you are anything like me, then you will have a child-like wonder at pretty much everything around you. I seem never to have lost my youthful naivety and am constantly asking questions about the way things work. My biggest progression is to have gone from the two year old catchphrase ‘why?’ to the geek catchphrase ‘how?’ – and actually I think this curiosity is no bad thing.
My latest quest has been to learn more about electronics and electronic engineering and to that end I have been doing a lot of reading in order to work out how you might go apart putting together some of the more basic electronic devices. With some help from a friend (who works building weapons) I’ve managed to get a basic grasp on how something like a digital alarm clock works, which I’m going to share with you here.
When looking at the inside of a digital alarm clock you will have several components. These will be the buttons/keypad, the buzzer, a display, a space for batteries, probably some resistors and transistors and a PIC.
Now all of the components will be connected to the PIC. This PIC is the ‘Peripheral Interface Controller’ or essentially the CPU of your device. This is made up of thousands of tiny capacitors (which store energy) that act as switches. These switches then create ‘logic gates’ meaning that they direct the flow of current so that you can choose where you want it to go and under which circumstances.
Now it would be impossible for you to make your own PIC. These devices use such minute circuits that you wouldn’t be able to see them all let alone solder them together. This is made in a factory by a single manufacturer and you don’t need to worry about it – you just buy one yourself.
From here you will connect the components you need to particular input/output nodes on the PIC and you will then plug your PIC in to your PC via a USB cable and a PIC programmer and this would allow you to program the PIC using machine code or C++.
Using this language you then write out several logic gates in the code so that you say – if there is current here, then direct current here’ and this is actually easier to understand than you might think.
For instance then to test if someone is pressing a button or not you can tell the PIC to keep sending current into the keypad, and to then test if it is interrupted by a button press or not. You can then instruct it to say that if that should happen, it should write ‘enter time’ onto the LCD display.
All this code can be found online relatively easily using something like Stack Overflow, and if you have a basic knowledge in programming then you will be able to pick this up (no pun intended) relatively simply.
All this might sound a little complicated, but if you buy a PIC programming tutorial you will find that it’s all within your capability.
The rest of what you need to know comes down to slightly more complicated electronics – the additional resistors and capacitors you’ll see are designed to prevent fluctuations in the signal etc. which could otherwise damage the reliability of your device. Again though you don’t really need to learn this, as long as you can find a good diagram and some basic information to help you get started.