Another important rule is to find a reliable way to reproduce a problem. If your circuit behaves in a funny way at random times, try really hard to identify what seems to cause this. Does it happen only when you press a switch? Only when an LED lights up? Whenever you move a jumper? (Many… Continue reading Isolating Problems
Testing Your Breadboarded Circuit
The next step is to check for short circuits between 5V and GND on your project. Connect your Arduino to your breadboard by running a jumper from the 5V and GND connections to the positive and negative rails of the breadboard. (Notice we are following the “divide and rule” principle by connecting only these two… Continue reading Testing Your Breadboarded Circuit
Testing the Arduino Board
Before trying very complicated experiments, it’s wise to check the simple things, especially if they don’t take much time. The first thing to check is that your Arduino board works, and the very first example, Blink, is always a good place to start, because you are probably most familiar with it, and because the LED… Continue reading Testing the Arduino Board
Exclusion and Certainty
While investigating, test each component separately so that you can be absolutely certain that each one works by itself. You will gradually build up confidence about which parts of a project are doing their job and which ones are dubious. The best way to do this is using the built-in examples, as they are unlikely… Continue reading Exclusion and Certainty
Simplification and Segmentation
The ancient Romans used to say divide et impera: divide and rule. Try to break down (at least mentally, and even better by sketching) the project into its components by using the understanding you have and figure out where the responsibility of each component or part of your program begins and ends.
Understanding
Try to understand as much as possible how the parts that you’re using work and how they’re supposed to contribute to the finished project. This approach will allow you to devise some way to test each component separately. If you’ve not already done so, try drawing a schematic of your project. This helps you understand… Continue reading Understanding
Introduction
There will come a moment in your experimentation when nothing will be working and you will have to figure out how to fix it. Troubleshooting and debugging are ancient arts in which there are a few simple rules, but most of the results are obtained through careful work and paying attention to details. More important… Continue reading Introduction
Internet Connected Fistbump: The Web Page
The web page consists of two files: index.html and sketch.js which contains the code which will detect a click and then send a message to the MQTT broker. The index.html file is quite trivial; it loads two libraries (p5.js and an MQTT library) and the sketch.js JavaScript code (which does all the work), enclosed by the… Continue reading Internet Connected Fistbump: The Web Page
Internet Connected Fistbump: Arduino code
The code below is commented fairly heavily, so I’ll only describe it here in general terms: The setup() function does 4 things: The loop() does the following: Note the first thing in setup() will cause the program to loop forever until the serial port is opened. This is to give you time to turn on the serial monitor, so that you… Continue reading Internet Connected Fistbump: Arduino code
Internet Connected Fistbump: MQTT Broker on Shiftr.io
As mentioned earlier, Shiftr.io provides a free public broker which anyone can use. This broker is accessed at public.cloud.shiftr.io. Note that anyone else can potentially access your messages or even send you a message. If you want a private broker, you need to set up an account on Shiftr.io. To connect to the public broker we… Continue reading Internet Connected Fistbump: MQTT Broker on Shiftr.io