Wednesday, 9 April 2025

TinkerCad microbit traffic light simulator (now with video)

Back to playing with TinkerCad in a previous post called explaining-tinkercad-microbit-neural, I used it to produce a simulation of a microbit-based neural network built around microbits. 

If you haven't played with this free tool to TinkerCad https://www.tinkercad.com/dashboard from AutoCad, I highly recommend it as a versatile, simple CAD system (that includes coding for microbits) with a load of support material. If that wasn't enough, it is free and online.

So, to experiment, I have made a simple traffic light simulator (an oldie but a goodie), so I can see what it can do a little more. Essentially, Red, Orange and Green LEDs (with appropriate resistors) are controlled by pins 0,1,and 2 on the microbit.


So here is a circuit with a microbit. The anode (the one with the bent leg)connects to the microbit pins through resistors. The cathode goes to the ground connection.





Here is the code for the microbit turning the LEDs on and off, and when it starts up putting a smiley face onto the microbit.









For those who like circuit diagrams, it can produce a more formal circuit diagram and the parts list (see below)- nice feature.









Have a play with the simulator below it goes a little bit further and changes the smiley face to letters (see the code below)



Possible ideas, change the LEDs to those that change colour, and now the approach can be used to provide a bit of control on the timings of those. Also experimented with replacing the smiley face with letters for LEDs colour (e,g, R for Red) - actually done that in the simulation above with the code below :-)





All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Friday, 28 February 2025

Using Elecfreaks microbit Smart home kit

Using Elecfreaks microbit Smart home kit http://bit.ly/43ooJFo a cool set of comments to build simulated Smart Building activities using a Microbit it works with either V1 or V2.



Start https://makecode.microbit.org/#editor

Go to extensions (see below) and then search for smarthome and add the package to the editor (ie, click on the extension and makecode does the rest)






Attach the microbit to the sensorbit


Making the voice activated light solution - the first activity follow the circuit in the book


To get "led enable" you will need to click in makecode like on LED option and then + to find it. You will also need to set up three variables light, strip and noise.
Here is the code

Only turns on the LED for 10 seconds when the light level is low and noise is above 78dB.


Playtime
Slight adaptation to the code, makes the LED change with sound level
The circuit is the same.


Conclusion
Based on this one activity it is a nice bit of kit. The range of actuators and sensors justifies the cost with things like moisture sensor , servo, water pump, OLED screen, temperature sensor, fan and more. It is worth a look.






All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

TinkerCad microbit traffic light simulator (now with video)

Back to playing with TinkerCad in a previous post called  explaining-tinkercad-microbit-neural,  I used it to produce a simulation of a micr...