MicroPython for Microcontrollers Module 10
Networking: Wi-Fi, sockets, HTTP, MQTT, TLS and radios interview questions
Interview questions on “Networking: Wi-Fi, sockets, HTTP, MQTT, TLS and radios”: warm-ups, then what each harder question tests and how a good answer starts.
Warm-up questions
Short questions with short answers, each answered in full.
-
Fresher
What does wlan.isconnected() tell you on a Pico W, and why is a loop that waits for it not enough?
Questions with model answers
What each question tests, the first step of a good answer and the follow-ups to expect.
-
Fresher to mid
After a power cut on a farm, 9 of 40 Pico W sensors stay offline until someone power-cycles them. Their boot code waits while wlan.status() == network.STAT_CONNECTING and calls machine.reset() for any other status. The last log line before each reset reads status 2. What is happening, and what do you change?
- What it tests
- Reading the Pico W's link states, how a router behaves after an outage, and replacing a status test with a deadline and a recovery that never needs a person.
- First step
- Status 2 on a Pico W is the driver's state for joined with no address yet. After a power cut the access point comes up before its DHCP server answers, so boards join and then wait. The loop reads that wait as a failure and resets, and each reset starts the join again from nothing.
- Follow-ups
-
- Why only 9 of the 40 boards?
- What timeout do you choose, and how do you check it?
- How do you make sure a board never needs a person to power-cycle it?
From the lesson Connect to Wi-Fi on Pico W and ESP32
Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.Opening the model answers with your pass…
Model answers open with any MySmartCoPilot pass.
- Pro pass · 1 week₹79$2.99
- 30 days₹179$5.99
- 1 year₹1,699$45
One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.
Passes can’t be bought right now, so the model answers can’t be opened at the moment. If you have a pass, enter your licence key.
It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).
In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A building's router restarts every night. Its 200 ESP32 boards retry every 500 ms with no limit, the router logs thousands of join attempts a minute when it returns, and some boards take 20 minutes to rejoin. Design the reconnect policy, with numbers.
- What it tests
- A deadline per try, a capped exponential back-off with jitter, resetting after a success, and keeping the port's own retries under the program's control.
- First step
- Count the load first: 200 boards trying every 0.5 s is 400 joins a second aimed at a router that is still starting. Then give each try a deadline of about 10 s, wait 2, 4, 8 s and so on up to 60 s between tries, add a random share to each wait, and reset the wait after a success.
- Follow-ups
-
- How much jitter, and why random rather than a fixed delay per board?
- What does a board do with its readings while it is offline?
- How would you test the policy without 200 boards?
From the lesson Connect to Wi-Fi on Pico W and ESP32
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
An ESP32 opens a gate when it receives the ESP-NOW frame b"open" from a remote button. Explain how someone who recorded one frame could open it again, and design the frame and the receiver's checks so that only a fresh command from the right button works.
- What it tests
- Telling authentication from freshness, a truncated HMAC with a per-device key, a counter that survives reboots, and what ESP-NOW's own encryption does and does not give.
- First step
- Separate two questions: who made the frame, and is it new. A fixed command answers neither, so add a counter and a tag of HMAC-SHA256 with the button's own key, and make the receiver refuse any counter not above the last one it accepted.
- Follow-ups
-
- How long must the tag be?
- What happens when the button's battery is changed?
- Why not rely on ESP-NOW's encryption?
From the lesson Bluetooth LE with aioble, and ESP-NOW
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Fresher to mid
A sensor sends its readings over ESP-NOW, and every send() returns True, yet the gateway's database is missing about a third of them, mostly after the sensor wakes from sleep and sends its backlog. What is going on, and what do you change?
- What it tests
- What send()'s True means, the receive buffer and its documented drops, pacing through answers from the receiving program, and testing the fix without radios.
- First step
- Read what True means: a radio on the same channel acknowledged the frame, which says nothing about the program on the gateway. Then follow a frame from that radio to the program, for a backlog that arrives in a burst.
- Follow-ups
-
- How do you confirm it on the gateway?
- What does the answer from the gateway cost the sensor?
- How do you test the new design without two boards?
From the lesson Bluetooth LE with aioble, and ESP-NOW
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 2 minutes
-
Mid to senior
A coin-cell Bluetooth LE thermometer built with aioble lasts weeks instead of the months planned. It notifies the temperature as text, every second. Which parts of the radio design would you change, and how do you check each change without guessing?
- What it tests
- Knowing what costs radio time in Bluetooth LE, compact standard encodings, notifying on change, advertising choices, and separating what a fake can test from what needs a meter.
- First step
- Count what goes over the air: a notification every second, in text, is far more traffic than a reading needs. Send the standard Temperature characteristic, two bytes, and notify only when the value changes by a set step, so the radio is idle most of the time.
- Follow-ups
-
- Which advertising interval would you choose?
- How do you show that fewer notifications still deliver every change that matters?
- What can only a measurement on the board tell you?
From the lesson Bluetooth LE with aioble, and ESP-NOW
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 2 minutes
All MicroPython for Microcontrollers interview questions · The MicroPython for Microcontrollers track