Friday, 28 February 2025

Using Elecfreaks microbit Smart home kit

Whether you're a student looking for a cool weekend project, a parent wanting to spark a child's interest in engineering, or a STEM maker exploring IoT (Internet of Things), the Elecfreaks Micro:bit Smart Home Kit http://bit.ly/43ooJF is a fantastic gateway

Smart home technology isn't just for big tech companies; it’s something you can build on your dining room table. In this post, we’re refining a project that mimics real-world smart building technology: a Voice-Activated Night Light.

What is the Elecfreaks Smart Home Kit?

The Elecfreaks Smart Home Kit is an all-in-one ecosystem designed to work with the BBC micro:bit (both V1 and V2). It comes packed with sensors—temperature, sound, soil moisture, and light—as well as actuators like servos and motors. It’s designed to be "plug, code, and play," removing the frustration of messy wiring so you can focus on the logic and creativity



The Challenge: The Smart "Energy-Saving" Light

Imagine a light that only turns on when it’s dark and when it hears someone in the room, then automatically turns off to save power. This is a classic "Smart Home" scenario.

What You’ll Need:


Step 1: Setting Up the Environment

Before coding, you need to tell MakeCode how to talk to the Smart Home sensors.

  1. Open a new project in .

  2. Click on Advanced, then Extensions.

  3. Search for "smarthome" and select the official Elecfreaks library. This adds new blocks specifically for the kit's components.







Step 2: The Logic (The "Brain" of the House)

For this project, we need the micro:bit to make a decision based on two conditions:

  1. Is it dark? (Light level is low)

  2. Is there noise? (Someone is moving or talking)

Pro-Tip for Makers: To get the most out of your LED strip, you might need to enable it. In MakeCode, click the LED category, then click the [+] or "More" option to find the led enable block.

The Variables

Create three variables to keep your code clean:

  • light: To store the brightness reading.

  • noise: To store the sound level.

  • strip: To control your Rainbow LED.


Step 3: The Code

Here is the logic you’ll build:

  • On Start: Initialise your LED strip to the correct pin (usually P1 in the Smart Home kit).

  • Forever Loop:  Set the light variable to the value of the light sensor.

    • Set the noise variable to the value of the noise sensor.

    • The "If" Statement: If light is less than a certain threshold (e.g., 50) AND noise is greater than 78dB, then turn the LEDs on.

    • The Timer: Use a pause block for 10,000ms (10 seconds) so the light stays on while you walk through the room, then turn it off.

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.


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


Why This is Useful for STEM Learning

This project isn't just about making an LED blink; it teaches the fundamental pillars of modern engineering:

  • Sensor Integration: Understanding how machines "sense" the physical world.

  • Boolean Logic: Using "AND/OR" statements to create complex triggers.

  • Threshold Calibration: Students learn that "78dB" or "Light level 50" are variables they must test and adjust based on their specific environment (a great introduction to the scientific method!).


Final Thoughts

The Elecfreaks kit is a "cool set of components" that bridges the gap between screen-based coding and physical reality. Once you've mastered the voice-activated light, try adding the OLED display to show the noise level in real-time, or use the Servo to create an automatic door opener!

Ready to start? Head over to and start building your future home today.







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

1 comment:

  1. I came across DealPromoX a few days ago while searching for some working promo codes, and I was actually impressed. Most of the discounts listed there still work, and the site seems to be updated regularly. It’s definitely worth checking if you like finding good online deals.

    ReplyDelete

DIY Data Science with microbits

DIY Data Science: A Complete Guide to Data Logging with the Micro:bit V1 Whether you are a STEM teacher looking for a classroom lab solution...