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:
BBC micro:bit (V1 or V2)
Elecfreaks Smart Home Kit (Breakout board, Rainbow LED strip, and Noise sensor)
Micro-USB Cable
MakeCode Editor (online at https://makecode.microbit.org/#editor)
Step 1: Setting Up the Environment
Before coding, you need to tell MakeCode how to talk to the Smart Home sensors.
Open a new project in
. Click on Advanced, then Extensions.
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:
Is it dark? (Light level is low)
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
lightvariable to the value of the light sensor.Set the
noisevariable to the value of the noise sensor.The "If" Statement: If
lightis less than a certain threshold (e.g., 50) ANDnoiseis greater than 78dB, then turn the LEDs on.The Timer: Use a
pauseblock for 10,000ms (10 seconds) so the light stays on while you walk through the room, then turn it off.
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.
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



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