What I wish I knew before starting iot

My first sensor lied to me for three days. It reported a comfortable room while I sat in a cold one, and I rewrote the display code twice before I thought to check the power supply. That pattern, trusting the wrong layer, has cost me more evenings than any bug in my own logic.

Buy two of the cheap parts

When a sensor costs less than a sandwich, order two. Half of debugging is deciding whether the problem is your code or the component, and having a known-good spare answers that question in a minute instead of an evening. Keep one of each part untouched in its packaging so that you always have a reference you have not damaged.

This applies to cables as well. A charge-only USB cable that cannot carry data will make a perfectly good board look dead, and a second cable is the fastest way to rule that out.

Design the power before you design the features

It is easy to build something wonderful on a bench, powered by a laptop, that cannot survive a night on a battery. Decide early how the device will be powered when nobody is watching: a USB adapter, a battery pack, or a solar cell. Each choice changes what the device can do and how often it can wake up.

Then design around sleep. A board that stays awake draining its battery is not a finished project, it is a countdown. Learn to put the device to sleep between readings, and check how long it actually lasts by leaving it running rather than by calculating it on paper.

Get it working with no internet at all

There is a particular kind of confusion that comes from debugging three systems at once: your code, the Wi-Fi, and a cloud account. Start with everything local. Make the board serve a page, or print a number, or store readings on a card. When that is solid, add one link at a time, and keep a way to run the old version so you can prove which part broke.

The same advice applies to tutorials. Most published projects assume a version of a library or a platform that no longer exists. When one does not work, change one thing at a time, and keep the sketch that last worked in a separate file with a date in the name.

Learn the multimeter before the next framework

A cheap multimeter teaches more than any library you could install in the same afternoon. You will use it to confirm a supply voltage, find a broken jumper, check that a ground really is a ground, and measure whether a battery is as full as it claims. These are the questions that stall most projects, and none of them are software questions.

Learn three settings and use them until they are automatic: voltage, continuity, and resistance. Everything else can wait until a project demands it.

Timebox the rabbit hole

There is always a deeper version of the problem available: the register-level explanation, the perfect power regulator, the framework that solves everything. Set a limit of twenty minutes on any side quest, write down what you learned, and return to the actual goal. The project that gets finished teaches more than the perfect one that does not.

Most of what I know now came from things I could have learned before the first order: buy spares, plan the power, start local, measure with a tool, and stop debugging when the clock runs out. The rest is just practice with a board on the desk.