What You’ll Need to Know

This book is not intended to teach you everything you need to know before you start building your starship lighting circuit. I’m afraid you’ll either need to already have certain skills or acquire them before you start. It’s outside the scope of this book to teach you these skills. So, what are we talking about:

Soldering

Although you could build the lighting circuit on breadboards, which requires no wiring, they’re not suitable for long-term use. A breadboard circuit has a lot of noise because the connections are tenuous—just a friction fit really. Also, components and jumper wires can easily come loose, and breadboards are bulky.

So, you will need to know how to solder components to a prototyping board, and the only way to learn is to practice. Fortunately, if you just type “how to solder” in YouTube’s search bar, you’ll find numerous tutorials. Watch of few of these and you will learn the basics. After that, it’s just practice.

I do feel like I should offer some pearls of wisdom, however. There are a few things I’ve done or learned that have greatly improved my soldering skills.

  • I bought a really nice soldering iron with a digital temperature control readout
  • I have vises and clamps to hold my work steady
  • I’ve learned to compulsively clean and re-tin the soldering tip
  • Apply flux to any difficult connections
  • I’ve learned to apply solder to the part(s) I’m trying to connect, not the soldering tip
  • Pre-tin any wires and any pads to which you’re soldering

We’ll address the soldering iron and the vises and clamps in the What You’ll Need chapter. Let’s look more closely at the last two tips.

Clean and re-tin

It’s extremely important to constantly clean and re-tin the soldering tip, otherwise you’ll need to constantly buy new tips. Solder tips oxidize (corrode) because of the high temperatures involved, but a clean tip protected by a coating of solder will last a long time.

If I’m soldering a resistor to a perfboard, for instance, I’ll first drag the tip across a wet sponge, then through a brass scouring pad, add fresh solder—just a little—to the tip and immediately solder one leg of the resistor to the board.

Then I drag the tip across the wet sponge again, then through the scouring pad, re-tin and immediately solder the remaining leg. After several soldering several components, I’ll instead clean the tip with the sponge and scouring pad and then put the tip in a small jar of tip tinner, run it through the scouring pad and then add a little solder.

Whenever I have to put the soldering iron back in its cradle, I clean and re-tin the tip with solder, even if I’m only pausing for a few seconds. Of course, I occasionally forget, but I mostly remember to clean and re-tin after each use.

Solder the part, not the tip

Apply the soldering tip to the thing you’re connecting to, like the circular pads on a perfboard, and the thing you’re connecting, like the leg of the resistor. Touch the solder to the pad, not to the tip of the soldering iron. The idea is not to add a lot of solder to the iron and hope it leaks onto the thing you want to attach. The idea is to heat the two parts and apply solder to the parts, allowing capillary action to draw the solder into the spaces between the parts.

Pre-tin wires and pads

You’ll avoid overheating integrated circuits and other components like LEDs if you pre-tin any wires or soldering pads. If I’m soldering a resistor to an LED, for instance, I’ll first tin the legs or leads of the LED and the resistor before attempting to solder them together. You’ll find pre-tinned leads join much more quickly, preventing overheating of components.

Use flux when needed

You can usually guess when a soldering connection will be difficult, like joining a small thing to a large thing, two large things or two tiny things. A dab of flux will make the job easier. However, remember to …

Clean up after soldering

Soldering rosin and flux can leave a lot of residue that could either corrode or cause unwanted short circuits. You should clean the residue with flux cleaner, or make your own with a 50/50 mix of isopropyl alcohol and acetone.

Programming

This book also isn’t intended to teach you basic programming concepts. It’s up to you to learn the basic concepts of variables, loops, if statements and programming blocks. Fortunately, the two sketches that make up our starship lighting circuit are very simple, and any previous programming experience is all that’s required to become familiar with C++.

C++ and Arduino programming is new to me,  and I was constantly googling the syntax of basic functions. When I didn’t find the answers, I found repeatedly slamming my head against the desk does work … after a day or so. In one case, I went to the Adafruit support board and posted a question and got no replies. So, I started replying to myself, suggesting what might be wrong and eventually answered my own question. It did take two days, though.

Electronics

Again, I can’t teach you electronics. I barely understand it myself, and frankly, you don’t really need to know a lot to make the circuit. If you follow the diagrams precisely, you’ll have no problems (assuming I’ve made no mistakes). 

But following the diagrams can be extremely difficult. I spent two days trying to figure out why the final circuit wasn’t working. Luckily, I have the habit that if a circuit I’m building isn’t working as expected, I immediately kill the power. Thank goodness, because what I’d done is connect one of the ATMega pins to power, not ground, and had created a short circuit. The circuit was drawing more and more power until the resettable fuse kicked in.

I didn’t realize this immediately, however, and tried other remedies. I’d re-connect the circuit to power, see it wasn’t working and kill the power. I spent hours looking at the circuit wondering what I’d done wrong. It wasn’t until I touched the resettable fuse and found it hot that I realized I must have a short circuit, but I still couldn’t see my mistake. It wasn’t until I removed the ATMega and saw that the ATtiny was working that I realized what I’d done wrong. Fortunately, the fuse did exactly what it was supposed to do.

One great way to learn both Arduino programming and electronics is at TinkerCad. This is a free website that lets you prototype circuits virtually. You can even program a virtual Arduino and hook it up to a virtual breadboard containing virtual components. The advantages are you don’t need to buy an Arduino and you’ll always have the right value resistor or capacitor. It’s much easier to wire a virtual breadboard and if you make a mistake, you’re only burning out virtual components.

There are disadvantages, of course. TinkerCad supplies a lot of components, but not, for instance the ULN2803A Darlington array or the Adafruit Sound Board, so you can’t test these out. Nor does it allow you to load additional libraries, like LedFlasher* or arduino-timer; you’re limited to the standard “built-in” libraries.

Nevertheless, I was able to virtually test parts of my circuits and sketches and then put it all together in the real world.

Debugging

You’re going to make a mistake somewhere, either with the electronic components or the sketches. To figure out the problem, use the 50/50 method. In programming, you do it like this. Somewhere in your sketch you’ve made a mistake, but you don’t know where. Either the sketch won’t compile or it doesn’t do anything. The error message the Arduino IDE returns is cryptic and unhelpful. Or worse yet, you’re uploading a sketch directly to the ATtiny or ATMega and there are no error messages.

To find the problem, comment out half your code. Of course, you’ll also need to comment out any calls that refer to the half of the code you commented out. Upload the sketch again—it still won’t do anything, but if it suddenly compiles, then whatever programming faux pas you’ve committed is somewhere in the code you commented out. Then uncomment half of that code and if it still compiles or at least some of the lights are blinking, then the problem is in the remaining uncommented code, or vice versa.

You can debug the circuit the same way. Strip away half the circuit and if it works, the problem was in the half you removed. You might move the ATtiny and everything connected to it—transistors, MOSFET, resistors, to a separate breadboard, give it power and see if it works.

Another trick is to recreate the problem in TinkerCad, if possible. That might not be possible if it involves a component or library unavailable in TinkerCad, but you can probably still recreate some part of the circuit. Perhaps you inserted a transistor into the breadboard backwards. That mistake will be a lot more obvious in TinkerCad because it labels the pins of the transistor, and suddenly you’ll realize you’re tying the emitter to ground instead of the collector.

NEXT: What You’ll Need

*I was able to copy out the code of the LedFlasher and paste it into the top of my sketch. Basically, I was creating a class within the sketch instead of using an #include to load it.

Leave a Reply