What you need
Put the firmware on it
Got your sensor from Fab Lab Bali? It already has the firmware, go to step 2.
You need this step if you built the sensor yourself, or want the newest version on it.
- On a laptop, open planetai.fab.city/sensors in Chrome or Edge. Safari, Firefox and phones can't talk to a USB port.
- Plug the sensor in with the data cable. Under The Bayu sensor, press Connect and flash and pick the port that says USB JTAG/serial or usbmodem. If no port shows up, unplug it, hold the BOOT button on the board and plug it in again.
- Let it run, about a minute. The page finds the chip by itself, a XIAO ESP32-S3 or an ESP32-C3 SuperMini.
Flashing again keeps the WiFi, token and name the sensor already had. If you want to see it working before going on, the Test tab on the same page shows each of its sensors reading live over the cable.
Make a Smart Citizen account
Go to smartcitizen.me and sign up. Keep the username and password at hand, you use them again in the next step.
Register the sensor
On your phone, open makingsense.fablabbali.com/setup.html.
- Sign in with the same Smart Citizen username and password.
- Give the sensor a name people will recognise, like Bayu · Banjar Kelod, say where it hangs, and pick outdoor or indoor.
- Drag the pin to the spot where the sensor will hang. Use my position works if you are standing there now.
- Press Create device. The page creates the device on Smart Citizen and shows its token, six characters, with a QR code.
Keep this page open, you need it in the next step. Treat the token like a password, whoever has it can publish data as your sensor.
Give the sensor its token and your WiFi
- Plug the sensor into the wall charger. A laptop port or a weak phone charger can't run the fan of the particle sensor, and it will keep restarting.
- On your phone, open the WiFi settings. Within a minute a network called MSB-Node- followed by six letters and numbers shows up (MSB is Making Sense Bali). Join it, the password is makingsense. If the phone says there is no internet, stay connected.
- Hand over the token. If the setup page from step 3 is on a laptop, scan its QR code with the phone camera. If it is on this same phone, go back to that tab and tap the link under the QR code, the one starting with http://192.168.4.1/t?token=. The sensor answers Token saved.
- Tap Choose WiFi, pick your network and type its password. It has to be 2.4 GHz, the sensor can't see 5 GHz networks. If your router shows two names, pick the one without "5G".
- Further down you can give it a name, where it hangs and its height above ground. These stay on the sensor, Smart Citizen never sees them. Leave Where it publishes empty, unless you have a PLANETAI node (see below).
- Press Save. The sensor joins your WiFi and the MSB-Node network disappears.
You have 3 minutes once the setup page opens. If it closes on you, unplug the sensor, plug it back in and start this step again, it keeps what you already saved. No setup page after joining? Open 192.168.4.1 in the browser. Lost the QR? Type the token into the Token field by hand, and check it twice, this is where most setups go wrong.
Wait for the first reading
Put your phone back on your normal WiFi and go back to the setup page. Its last step waits for the first reading, the sensor publishes once a minute, then lists what it measures and links to your device page on Smart Citizen.
The sensor also has its own status page. Open http://your-sensor-name.local, with the name you typed in lowercase and hyphens for spaces, so Banjar Kelod becomes banjar-kelod.local. Token should show two characters and stars, and Last publish should say ok. Some Android phones can't open .local addresses, in that case look for the sensor's IP address in your router's list of connected devices.
On a XIAO ESP32-S3 the small LED tells you the same thing. One short flash every 5 seconds means online and publishing, two flashes means it is offline or publishing fails, fast blinking means the setup page is open.
Hang it
Outside in the shade, 1.5 to 3 m above the ground, with the underside open to the air, because the air goes in from below. Keep it away from anything that makes its own smoke or heat, like a kitchen vent, an AC exhaust, a generator or the spot where people smoke.
Put a label on the plug saying Air sensor, do not unplug. Someone borrowing the socket to charge a phone is the most common reason a sensor goes quiet. Then tell us in the WhatsApp community that yours is live.
With your PLANETAI node
If you run a PLANETAI node in the house or the lab, the sensor can publish to it over your own network. The node keeps every reading, also when the internet is down, and can pass them on to Smart Citizen for you. You do steps 1 to 6 as above, with one change in step 4.
- On the machine running the node, open a terminal and run:
planetai broker
It prints what the sensor needs, and then waits 3 minutes for the first message, so go straight to the next step. - In the sensor's setup page, under Where it publishes, type what it printed:
- Host
- the node's name ending in .local, or its address
- Port
- 1883
- User
- planetai
- Password
- the one
planetai brokerprinted
- For the token, use the one from step 3 if you want the sensor on Smart Citizen too. If the node is the only one reading it, any six characters will do.
- Leave If the PLANETAI node stops answering, publish to Smart Citizen ticked. With a real token, the sensor then goes straight to Smart Citizen while the node is down, and back to the node when it answers again.
To have the node pass the readings on to Smart Citizen, give it the sensor's token. Readings wait in a queue while the internet is down and go out when it comes back.
planetai config set SC_FORWARD <token>
Then add the sensor's Smart Citizen id, the number in its device page address, to SC_EXCLUDE, so the node doesn't read the same sensor a second time from the platform.
Sensor already set up and running? Open its status page, tap Reopen setup, and join the MSB-Node network again within about 15 seconds. Everything you saved before is filled in, you only add the node.
If something goes wrong
- The flasher shows no port.
- The cable is probably charge-only, try another. If it still shows nothing, hold BOOT while plugging in.
- The flasher says the port is busy.
- Another program has it open. Close the Arduino IDE serial monitor and any other tab with a flasher, unplug the board, plug it back in and press the button again.
- I can't see the MSB-Node network.
- The sensor only opens it when it has no WiFi saved, or can't reach the one it has. Unplug it, wait 5 seconds, plug it in, and give it a minute.
- I moved house, or changed my WiFi password.
- Plug the sensor in at the new place. It won't find its old WiFi, so after about 20 seconds it opens the MSB-Node network again. Do step 4 again.
- The status page says Token NOT SET, or Last publish says failed.
- The token is missing or mistyped. Tap Reopen setup and type it again, character by character, from the Smart Citizen device page.
- The sensor keeps restarting.
- Almost always the power supply. Use a 5 V / 2 A wall charger.
- Still stuck?
- Ask in the WhatsApp community, with a photo of the status page.
About the readings
The temperature reads 1 to 3 °C high and the humidity a bit low, because the electronics warm up the box. We know about it and correct it later, in the data. PM2.5 is the number the campaign relies on. When a new sensor goes up, we compare it for a week with a reference sensor nearby before we lean on its numbers.