building-a-digital-timer-with-the-bbc-micro:bit

Timed activities such as sports, gaming, and cooking are monitored and alerted with digital timers. A digital timer uses an electronic counter circuit to keep track of timed events or activities based on preset and an accumulated- values being equal. The preset value can be set using either a rotary based control, a keypad, or discrete tactile pushbuttons. After the preset value has been set, the electronic counter will then accumulate time, thereby creating a predetermined delay in the timer.

Upon the accumulated value reaching the preset time value, the digital timer will trigger an output wired circuit. Traditionally, a transistor Open Collector (O.C) is used to drive an electromechanical relay. The electromechanical relay can control an electrical load wired to its switching contacts. Also, a digital display such as a seven segment LED or LCD can be used to show the digital counters’ pulses.

A digital timer circuit using discrete Transistor-Transistor-Logic (TTL) integrated circuits (ICs) and electrical-electronic components. (Image source: Don Wilcher)

A typical digital timer

Besides digital timers being deployed in consumer application-based activities, these programmable devices are found in manufacturing facilities. For small industrial control applications such as operating electropneumatic, electrohydraulic circuits or running parts conveyors, digital timers can be implemented quite easily. The preset value is traditionally set using a pair of discrete tactile pushbutton switches. The tactile pushbutton switches allow the operator to change the preset value. The time can be adjusted for an up or down count trigger setting. Once set, the internal electronic counter will proceed to count based on the time adjusted by the operator using the tactile pushbutton switches.

A digital timer can be easily constructed using a few off the shelf components. A typical digital timer has several digital and analog circuits for setting the preset value and displaying the time.

This timer’s, output control, and display functions can be implemented using a BBC micro:bit and an electromechanical relay.

The BBC micro:bit Specs

The BBC micro:bit is a small embedded platform that allows a variety of smart electronic devices to be created by makers, educators, hobbyists, and engineers. The electronics prototyping platform is engineered to be programmed in a variety of coding languages like Javascript, MicroPython, CircuitPython, or Google Blockly code.

Several external electrical and electronics devices and circuits can be attached to the micro:bit using an etched printed circuit board (PCB) edge connector. At the heart of the micro:bit is a Nordic Semiconductor nRF51822 system on a chip (SoC) integrated circuit (IC). The nRF51822 SoC IC is a low power device operating at 3.3V direct current (DC) supply voltage. Included within the SoC is a 2.4GHz transceiver and a 32bit ARM Cortex M0 central processing unit (CPU) with an integrated temperature sensor. Also, flash memory, Bluetooth low energy (BLE), an accelerometer, analog, and digital circuit peripherals support the micro:bit. In addition, the micro:bit uses a 5×5 array of discrete LEDs to display text messages, images, and numerical values.

The BBC micro:bit is populated with a nRF51822 SoC and supported by analog and digital electronic circuits. (Image source: BBC micro:bit)

The micro:bit Digital Timer Build

To build a digital timer using the micro:bit basically requires four building block components: the digital timer code, a micro:bit, a transistor relay driver circuit, and an electromechanical relay.

A system block diagram for a micro:bit Digital Timer. (Image source: Don Wilcher)

A solderless breadboard can be used to wire three of the four building block components together. Also, the discrete electromechanical relay and transistor relay driver component circuits can be wire on a solderless breadboard. Although this method of construction is okay, another approach is to insert the micro:bit into an interface board which provides four input/output connectors, a 3.3VDC supply, and ground. The transistor relay driver and electromechanical relay can be purchased as a single module. Both circuit components are conveniently populated on one PCB. A small jumper harness is attached from the interface board to the transistor driven relay board making the electrical interface between the micro:bit and the electromechanical relay circuit conveniently easy.

The micro: bit attached to the transistor driven relay board with a mini jumper harness. (Image source: Don Wilcher)

The two tactile pushbuttons allow the digital timer’s preset time to be adjusted using button A on the micro:bit. Locking in the preset time is accomplished using the B button. Pressing both the A and B buttons together will start the count-down timing sequence.

Setting the preset time on the micro:bit Digital Timer. (Image source: Don Wilcher)

The digital timer function can be coded using Javascript or Google’s Blockly Code. Also, prior to downloading the code to the physical micro:bit the software can be tested using the Microsoft Makecode micro:bit simulator. Such a debug feature will capture software function glitches and errors prior to deploying the code on the physical device.

The micro:bit Digital Timer Blockly Code. (Image source: Don Wilcher)

The Javascript micro:bit Digital Timer code. (Image source: Don Wilcher)

Code testing on the Microsoft micro:bit Makecode simulator. (Image source: Don Wilcher)

After the displayed count-down value reaches zero, the message Device ON will scroll across the discrete LED display.

Various electrical devices like DC voltage small electric motors and electronic devices can be operated using this simple but effective digital timer. Additional information on the micro:bit can be found on the following website. The Microsoft Makecode programming environment can be found on its website as well.

Don is a passionate teacher of electronics technology and an electrical engineer with 26 years of industrial experience. He has worked on industrial robotics systems, automotive electronic modules and systems, and embedded wireless controls for small consumer appliances. He’s currently developing 21st century educational products focusing on the Internet of Things for makers, engineers, technicians, and educators. He is also a Certified Electronics Technician with ETA International and a book author.

27 comments

  1. Hey! I just wanted to ask if you ever have any problems with hackers? My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no backup. Do you have any methods to stop hackers?

  2. Hey There. I found your blog using msn. This is an extremely well written article. I will make sure to bookmark it and come back to read more of your useful information. Thanks for the post. I’ll definitely return.

  3. Hmm is anyone else having problems with the pictures on this blog loading? I’m trying to find out if its a problem on my end or if it’s the blog. Any responses would be greatly appreciated.

  4. Hello just wanted to give you a quick heads up. The words in your post seem to be running off the screen in Ie. I’m not sure if this is a format issue or something to do with web browser compatibility but I thought I’d post to let you know. The design and style look great though! Hope you get the problem resolved soon. Kudos|

  5. Definitely believe that that you said. Your favorite reason seemed to be on the web the simplest thing to consider of. I say to you, I definitely get irked whilst people think about worries that they just don’t realize about. You controlled to hit the nail upon the top and defined out the entire thing with no need side effect , folks could take a signal. Will probably be again to get more.

  6. I like this weblog so much, saved to bookmarks. “Respect for the fragility and importance of an individual life is still the mark of an educated man.” by Norman Cousins.

  7. Excellent items from you, man. I have understand your stuff previous to and you’re simply too wonderful. I really like what you’ve acquired right here, really like what you are stating and the way by which you say it. You make it enjoyable and you continue to take care of to keep it smart. I can’t wait to read far more from you. That is actually a wonderful web site.

  8. Wow, fantastic blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is fantastic, as well as the content!

  9. You actually make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complex and very broad for me. I am looking forward for your next post, I’ll try to get the hang of it.

  10. I’m extremely impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you modify it yourself? Either way keep up the excellent quality writing, it’s rare to see a nice blog like this one today.

  11. I haven¦t checked in here for some time as I thought it was getting boring, but the last few posts are good quality so I guess I¦ll add you back to my everyday bloglist. You deserve it my friend 🙂

  12. Nice post. I was checking constantly this blog and I’m impressed! Extremely helpful information specially the last part 🙂 I care for such information a lot. I was looking for this certain information for a long time. Thank you and good luck.

  13. I wish to express my admiration for your kind-heartedness giving support to women who really need help on your subject matter. Your very own commitment to passing the solution across became certainly insightful and has in most cases encouraged folks much like me to reach their desired goals. The warm and friendly report can mean a whole lot to me and extremely more to my office workers. Many thanks; from each one of us.

Leave a Reply

Your email address will not be published.