Main rule: Always make each component work on its own before combining them. Use a separate script for each. Troubleshooting a combination of sensors and actuators is a hundred times easier when you are sure each part is working. Skipping that step will lead to confusion and despair.
- Check if all connections are correct.
- Check again. Make sure wires and components are in the correct rows of the breadboard.
- Are the wires and components connected to pins that correspond to the code you are using?
- Double-check if components are in place exactly like in the schematic.
- Randomly changing wire connections in a circuit has never solved anything.Figure out why it is not working instead of just pulling out wires.
- To find out why a circuit is not working, use a multimeter. See what voltage components are getting, test for continuity (also for unwanted connections a.k.a. short circuits) or test resistance values.
- Randomly deleting chunks of code has never solved anything. First figure out what you want your code to do and what it is doing now.
- To find out why code is not working as expected, use print functions. A lot. Especially to check if conditions (like if statements) are ever true.
- If sensor values do not change or are random, then the sensor is not connected — see ’troubleshooting circuits’.
- Error messages are your friends. They help you by telling you what the problem is and where it occurs. Try to understand what is going wrong where.
- When you don’t understand the error messages, then put them in “quotes” in a search engine to see what other people have done to fix it.
Use red wires for plus and black for minus.
Make sure all solder joints and other current-carrying parts are isolated with tape or heat-shrink tubing before turning the power on.
Wires that are not soldered, hot-glued and/or taped down will come loose (probably five minutes before your deadline or presentation).
Wires on LED strips, motors and piezo disks that are not covered under hot glue or tape will come off (probably five minutes after you soldered them).
Add comments to your code to remind you what it does. If you don’t put in comments you will have forgotten what everything does the next time you look at the script.
More golden rules for problem solving
You have to be methodical about problem-solving or you might as well try to solve things with song or prayer. Always solve one problem at a time.
Again: never start combining components before you know for certain each one is working separately.
Otherwise when the project is not working it is impossible to know which part is the problem.
Don’t panic when it does not work. It never works right away.
Find clear tutorials for whatever you want to do. Actually read them. A recipe to bake a cake is of no use if you only look at the pretty pictures.
Videos are great to get inspiration or to get the general idea of a technique.
Videos are quite useless as guides or instructions — you are better off reading texts.
Use Google (or DuckDuckGo), constantly.
ChatGPT is not as good at programming as you think it is. To know which answers actually make sense, you already have to know how to code. You are better off with tutorials and answers on forums.
If you cannot find a ton of easy-to-follow tutorials on how to make something, you have either thought of something very original or something near-impossible.
When something worked before but now it doesn’t, find out what changed. Did wires come loose? Are they still in the right place? Or did the battery die?
Don’t give up. You have to be more stubborn than your project.
General Hacklab wisdom
Everything is possible.
The only real constraints on a project are physics and how motivated you are to make it work.
Making things with electronics can be awesome, but it is something that has to be learned. No-one magically knows how any of this stuff works.
Everyone can do and make things with electronics. The only thing required is learning and experience. This is true for electronics just as for any other medium like paint or clay.
If you think of yourself as ‘not a technical person’ then you are holding yourself back.
There is no such thing as being a technical person. The only difference between you and ‘a technical person’ is that they tried out a few more things.
Do not be afraid to make mistakes. It will only hinder you in learning things.
Do not be scared to break things.
Breaking things is good, it means you tried something instead of not trying it.
You should be scared of wall-power, transformers and lithium-ion batteries.
When starting a project, think of what the simplest version could be that would suffice. If you build that first, then at least you’ll have something when the grander version fails or when you run out of time.
Make notes. It will make future-you smarter.
Do not save a lot of different versions of a file, they will only confuse you.
If you do save a separate copy of a script, add a comment at the top explaining what it does and why you kept it as a separate copy.
Close browser tabs. It will make you and your computer work faster. Keeping more than six tabs open will constantly make you waste time trying to find the right one.
And trust me on the hot glue.