Five projects students build with DFRobot sensors, and how to build them in the browser

This article looks at the five kinds of project that students build most often with DFRobot Gravity sensors in Velxio, a free browser-based electronics simulator: a smart farm, a water-quality monitor, an air-safety alarm, a heart-rate monitor and a radar distance warning. Each one comes with a ready-to-run example, the idea it teaches, and the step from the simulator to the real hardware.

When I started Velxio, I wanted a place to try a whole embedded project before buying the parts: the board, the sensors, the wiring and the real firmware, all in a browser tab. When DFRobot's Gravity sensors joined the catalog, I expected makers to play with them. What happened instead is that students picked them up for their coursework, mostly in Indonesia, India, the Philippines and Thailand, and the same few projects started to appear again and again.

This article walks through those five projects. For each one there is a ready-to-run example that we built in the same style as the students' circuits, the idea it teaches, and what changes when you move it to the bench. All five run on DFRobot's FireBeetle 2 ESP32-E.

What Velxio is, in two lines

Velxio is a web app at velxio.dev that simulates microcontroller boards and the parts around them. The firmware is real: your Arduino sketch is compiled with the same core and libraries you would flash, and it runs on an emulated chip. You can open and run every example below without an account. A free account lets you save your own projects, and paid plans add features such as private projects. The core is open source and can be self-hosted. See velxio.dev/pricing for the details.

1. The smart farm

A smart-farm controller in Velxio: FireBeetle 2 ESP32-E, two Gravity soil probes, a DHT22, two pump outputs and a 20x4 LCD

Running in Velxio: bed 2 is at 30 %, under the 35 % line, so its pump is on; bed 1 is at 60 % and waits. The LCD and the serial monitor show the same state.

This is the project students build most, by a wide margin. A Gravity capacitive soil-moisture probe goes into each bed, a DHT22 reads the air, each bed gets a pump output, and an LCD shows the state on the greenhouse wall. In the example a blue LED stands in for each pump; on the bench that pin drives a relay module.

What it teaches. Two thresholds instead of one. A pump that switches on below 40 % and off above 40 % chatters forever around that line. The example switches each bed's pump on below 35 % and only off again above 55 %, and it caps any single watering at fifteen seconds in case a probe fails.

From the simulator to the bench. Every capacitive probe reads a little differently. Calibrate yours by noting the reading in dry air and in a glass of water, and put those two numbers in the sketch's DRY_MV and WET_MV.

When a garden has more beds than the board has analog pins, an ADS1115 converter on I2C adds four more channels per chip. Several students arrived at that design on their own.

2. The water-quality monitor

A water-quality monitor in Velxio: FireBeetle 2 ESP32-E, Gravity pH probe, a temperature sensor, an ultrasonic level sensor, an OLED and a servo valve

Running in Velxio: pH 7.2 and 25.0 C, the tank 60 % full, the valve closed. The pH probe is below the board, the ultrasonic sensor on the left and the servo valve on the right.

Aquariums, fish ponds and hydroponic tanks all need the same loop: read the water, decide if it is in range, show it, and act. The Gravity Industrial pH probe gives the pH, a temperature sensor and an ultrasonic level sensor complete the picture, an OLED shows the readings, and a servo opens a valve when the level drops.

What it teaches. The read, classify, display and act pattern that every monitoring project uses, and the arithmetic of an analog probe. The pH board outputs about 1.5 V at pH 7 and its voltage falls by about 0.18 V per pH unit, so the sketch converts a voltage into a pH with one line of algebra.

From the simulator to the bench. The simulated probe follows the real module's voltage curve, so the conversion code stays the same. On the bench you add a two-point calibration with the pH 4 and pH 7 buffer solutions that come with the kit.

3. The air-safety alarm

An air-safety alarm in Velxio: FireBeetle 2 ESP32-E, Gravity MQ-7 CO sensor, DHT22, fan and alarm lights, a buzzer, a reset button and an OLED

Running in Velxio with the CO slider at 300 ppm: the alarm is latched, the red light and the fan are on, and the OLED says ALARM until someone presses RESET with the air clear.

Kitchens, garages, mines and poultry sheds: wherever gas can build up, students build an alarm. A Gravity MQ-7 measures carbon monoxide, an output starts a ventilation fan (a green LED in the example), and a buzzer and a red light warn whoever is nearby.

What it teaches. An alarm that stays on. Once the CO level crosses the danger line, the example keeps the alarm latched until someone presses the reset button, even if the air clears for a moment. That is how real safety equipment behaves, and it is a good first state machine.

From the simulator to the bench. A real MQ-7 needs a warm-up period before its readings mean anything, and its output depends on temperature and humidity. The example already waits for a warm-up at start-up; on the bench you make that wait longer and calibrate the sensor in clean air.

4. The heart-rate monitor

A heart-rate monitor in Velxio: FireBeetle 2 ESP32-E with the Gravity ECG sensor, an OLED showing the beats per minute, a buzzer and an LED

Running in Velxio at 72 beats per minute: the red LED flashes on every beat and the OLED shows the averaged rate.

Health monitors are the favourite project of biomedical and electronics students alike. The Gravity Analog Heart Rate Monitor (an AD8232 ECG front end) streams the heart's electrical signal into an analog pin, the board counts the beats, and an OLED shows the rate with an alarm outside the normal range.

What it teaches. Turning a waveform into a number. The sketch detects each beat with a threshold and a short lockout, so one heartbeat is never counted twice, and it averages the last few intervals to get a steady reading.

From the simulator to the bench. In Velxio the heart rate is a slider, so you can test a slow, normal and fast heart in seconds. On a real person the signal is noisier: electrode placement and keeping still matter, and the same threshold logic usually needs a small adjustment.

5. The radar distance warning

A distance warning in Velxio: FireBeetle 2 ESP32-E with the Gravity C4001 mmWave radar, an OLED and a buzzer

Running in Velxio: a target 3 m away closing at 1 m/s, so contact in 3 seconds and an amber WARNING. At 2.5 m/s it turns red and the buzzer sounds.

Parking aids, vehicle safety units and smart doors all start with the same question: how far away is that object, and is it coming closer? The Gravity C4001 mmWave radar answers both, distance and speed, over I2C. The example turns the two readings into a time-to-contact warning.

What it teaches. Combining two measurements into one decision. An object two metres away that is standing still is safe, and the same object approaching at two metres per second is not. The sketch divides distance by approach speed and sounds the buzzer when the result drops under two seconds.

From the simulator to the bench. The example uses DFRobot's own C4001 library, the same one you install for the real module, so the code runs unchanged on the bench.

Try one now

You do not need an account or any installation for this:

  1. Open the smart-farm example: https://velxio.dev/example/dfr-smart-farm
  2. On the toolbar at the top, click the Run button (►). The backend compiles the sketch, you can watch the build log, and then the FireBeetle starts.
  3. Click the first soil probe and drag its moisture slider down below 35 %. The bed's blue pump LED lights up and the LCD shows PUMP ON.
  4. Drag the slider back above 55 %. The pump stops. Between the two values it holds its state: that is the hysteresis from section 1. Leave it dry for 15 seconds and the bed switches to REST, the safety cap.
  5. To keep your own version, sign in and click Duplicate.

Every DFRobot part in the editor has a link to its product page, so when the circuit works, the shopping list is one click away.

Why practise with a simulated sensor

A simulated Gravity sensor is an analog or digital source that feeds the board through the same pin as the real one, and you control what it measures while the code runs. That turns the slow part of a sensor project into the fast part. Testing "soil dry, pump on" and "soil wet, pump off" on a bench takes a glass of water and a towel; here it takes two movements of a slider. Students can try every branch of their code, including the ones that are hard to reproduce for real, such as a CO leak or a heart beating at 150 per minute.

What a simulator cannot give you is the physical world: probe calibration, sensor warm-up, electrical noise and loose jumper wires. Each project above includes a note on what to expect when you move it to real hardware.

For teachers

The five projects share a shape that makes a good assignment: one board, two or three sensors, a display, an actuator, and a rule that connects them. Students can build and debug the circuit at home with nothing installed, and the circuit they bring to class is the one they wire on the bench. Velxio has a Classroom plan for schools; write to [email protected].

The DFRobot boards in Velxio include the FireBeetle 2, Beetle and Romeo families, the DFRduino boards and the UNIHIKER K10 and M10. You can browse the ready-to-run DFRobot examples at velxio.dev/examples/?q=dfrobot.

Velxio is open source on GitHub. If a DFRobot part does not behave in the simulator the way it does on your desk, please open an issue.

License
All Rights
Reserved
licensBg
0