Remote Data Logging with Two Micro:bits
In a previous post, we used a single micro:bit to log sensor data. That worked well, but it came with a significant limitation: the micro:bit had to stay plugged into the computer the whole time. In many real situations, you want to place a sensor somewhere away from your computer — across a room, outside a window, or just somewhere more useful.
The solution is to split the job between two devices: one micro:bit collects and transmits sensor data wirelessly, while the other receives it and passes it to your computer for logging. This is actually very close to how remote monitoring systems work in the real world.
The Plan
We'll build on the previous data-logging project and turn it into a simple wireless monitoring system.
Tip: To avoid confusion, program each micro:bit separately. Only plug one in at a time, and use a separate MakeCode window for each.
Micro:bit 1 — The Transmitter
This micro:bit handles the sensing. It reads the light level and temperature, then broadcasts those values wirelessly using the micro:bit's built-in radio. You can read more about how the radio works here.
The key idea is that both micro:bits are set to the same radio group — just a shared number that lets them communicate with each other while ignoring other devices.
Once programmed, this micro:bit doesn't need to stay connected to the computer. Attach a battery pack and you can move it wherever you want to take measurements. That's what makes it remote.
Micro:bit 2 — The Receiver
This one stays plugged into your computer. It listens for incoming radio signals from the transmitter and, when it picks one up, stores the received values in variables. It then writes those values to the MakeCode data viewer, exactly as the single-micro:bit version did.
To make this work, it needs to:
- Use the same radio group number as the transmitter
- Identify which value has been received (light or temperature) based on the label sent with each reading
- Log the value to the serial output for the data viewer to display
.
![]() |
| Figure 2 Reciever |
Seeing It in Action
Once both micro:bits are running, open the Show Data panel in MakeCode on the receiver's window. You should see graphs updating in real time, just like before.
Temperature changes slowly, so don't be surprised if that line looks fairly flat at first — try holding the transmitter in your hand to warm it up gradually. Light is easier to experiment with: point the transmitter's LED panel toward a bright screen or lamp and you'll see the values respond immediately.
To save your data as a CSV file and open it in a spreadsheet later, use the blue download icon in the data viewer — same as before.
![]() |
| figure 3 Data logging remotely |
Ideas to Take It Further
- Add a visual indicator on the transmitter. When it's running without the computer, there's no obvious sign it's doing anything. Could you add something to the display to show it's actively sending data?
- Experiment with sampling rate. Right now the transmitter sends data as fast as it can. Try replacing the
foreverloop with one that sends data at set intervals — like once per second or every five seconds. This mirrors what we did in the single micro:bit version and can make your graphs much easier to read.



Comments
Post a Comment