After getting the analog meter up and running last time I took the standard Arduino “Fade” example and modified it to make sense with a meter instead of an LED.
I modified the “fade” sketch with more variables (for easy alteration) and playing around with quite a few settings. I added variables for the initial needle position on the gauge, how far to swing the needle and how fast to swing the needle. I also added some minor logic to derive maximum/minimum swing values for ease of alteration.
I found that swinging the needle about 10 points (out of 255) to either side of the initial value (so a “sweep” of 20, or just under 10% the total available distance) at a speed of 15 gave a pretty good “jitter” effect:
The code I made is below if anyone is vaguely interested or would like to laugh at my programming skills.
For an upcoming Steampunk/Electronics project, I want to use an analog meter and an Arduino. My idea is to use the PWM (Pulse Width Modulation) feature of an Arduino to swing the analog gauge around.
Digging around on Google, I found a site that describes using an Analog Gauge with an Arduino and gives me the key information I need, which is that you need an inline resistor to change the 5V generated by the Arduino into whatever the Analog Gauge is calibrated to. The small gauges I got via ebay were a 0-50uA (microamps) and a 0-1mA (milliamps), so I’d definately need a resistor. The article above happens to use a 0-1ma meter like one of the two I bought, so I knew I’d need a 4.7k resistor for it. Using a convenient online Ohm’s Law Calculator I found that for the uA meter, I’d need a 100k resistor.
I breadboarded up the setup — its very easy: connect Arduino digital pin capable of PWM to the proper sized resistor and then to the plus side of the meter, and the negative side of the meter to ground. I used the standard Arduino Fading LED Tutorial to make the analog dial swing, here is the rough result with to 0-1uA meter:
The next step will be to write an Arduino sketch that sets the meter to a somewhat random value and “bounces” around that value for some dramatic effect. I may also include a potentiometer (a variable resistor) so I can use a dial to “tune” the analog meter in the final project.
A great friend of mine is going to PAX West as EDI, a character from Bioware’s Mass Effect 3. I helped her with the LEDs to illuminate the visor.
I was originally planning on deadbugging the whole thing — no circuit board at all, just inline splices, but the friendly EE at work told me it would make much more sense to use a perfboard, and would make things much easier. Boy, was he right!
The setup has 6 LEDs: 3 on each side, each with its own resistor, because I needed to keep the battery weight low (3 AAA). If I could have gone with higher voltage, I could have used fewer resistors, but this worked out pretty well. I used the LED Series/Parallel Array Wizard to calculate the resistor sizes, based on the info off the flat 3mm orange LEDs I got from ebay.
Here is what I did:
For wiring, I used cat 5e ethernet cable, which has 4 pairs of wires: each pair consists of a color coded set, one solid, one striped, that are twisted together (hence, ethernet cable being called “twisted pair.”) I trimmed the pair I wasn’t using close to the outer plastic shield and used the other 6 wires, 2 wires for each LED, one cable for each side of the visor. I stripped the cable down to the individual wires at each end for soldering.
I got a tiny (1.75″ square) perfboard from Radio Shack (again thanks to the EE for the suggestion) and soldered the 6 47Ohm resistors a few pegs from the edge of the board. Where the resistors would attach to the negative battery lead, I soldered all 6 resistors together in a huge blob. I then soldered the solid-colored wires (3 from each cable) near the edge of the board, and connected each solid wire to its own resistor.
The striped wires I cut longer and soldered in a line near the other side of the perfboard. These also got soldered together in a blob and connected to the positive lead from the battery.
The LEDs themselves were a bit more of a pain, partially because I was extra nervous about making sure I didn’t accidently connect the positive lead to the negative supply. Originally I just tried straight soldering the LED lead to the ethernet wire but things kept moving around, so I made a little loop on each wire and lead and hooked the two together, making a really solid mechanical connection. This worked much better, but I kept forgetting to take into account the longer positive lead, so I kept making a little loop of ethernet wire for the positive side to take up the extra space. At each step (individual soldered wire and each LED) I used heatshrink tubing to make sure everything was together as solidly as I could.
After testing, I covered the entire perfboard (front and back) with a ton of hotglue. Again, this was a suggestion from the EE, as it provides not only insulation for the components but some strain relief for the cabling. I used about 3 sticks! After I hotglued everything, I grabbed a small piece of foamcore that The Artist Wife was using for a project of hers and cut it to slightly larger than the perfboard and put it on the back (to further protect the solder traces) — the hotglue was tacky at this stage so it stuck nicely. Finally, I cut a piece of 1.5″ shrink tube to size and shrunk it on. I wanted to be sure that none of the components could possibly short out due to sweating in the helmet, and to provide as much protection and strain relief for the cabling as possible.
I’m pretty happy with how things turned out, and I learned quite a bit: I’ll be using perfboard for more projects, and I need to be more aware of the difference in the lead lengths (positive vs negative).
I just finished building a “Mintyboost” kit — its a tiny little cell phone charger that fits in an Altoids gum tin, and charges your phone from a pair of AA batteries. It comes as a kit: all the parts and a printed circuit board for about $20, and it took me about 90 minutes including fixing my mis-soldered part, probably an 45-60 minutes if I hadn’t messed that up.
I didn’t do half bad! My soldering improved as I went, but I did have one part I soldered in the wrong place, and removing that was a pain! I need to get some solder wick to fix that.
Fully installed in the tin:
The “business end” — I covered the cuts I made in the tin with electrical tape to protect from the sharp edges.
Now that my thumb is (mostly) healed, I finally tried my hand at soldering, a skill I’ve wanted to pick up for a while, but and one I’ll need for the electronics projects I want to do.
After talking to the EE and others at work, I bought a decent adjustable soldering iron from Sparkfun for $40, along with some support parts (hookup wire, snips, etc).
The first project is a larger version of Make Magazine’s “Candy tin extractor fan” — I used a larger plastic pencil box from Walmart ($1) so I could use an 80mm fan instead of the small 20mm from the guide.
The LCD Screen I’m using uses a lot of pins. In fact, it takes up all the available inputs on an Arduino Duemilanove and even then you can’t use the SD card and Touch at the same time because the Duemilanove doesn’t have enough pins. I’m not really planning on using touch (at least yet) so I’m not too worried about that at least for now. There is the Arduino Mega which has a lot more inputs (and the LCD manufacturer does make a shield for it that lets you use everything) but I don’t own any of those yet and I own 3 Duemilanove. There is the possibility I may need a smaller screen, and if I do, I’ll buy the Mega Shield.
I came up with the idea to use a second Arduino, a Nano – and the MP3 shield they make for it for the audio. The Nano and its MP3 shield are tiny (and the MP3 shield is the same price for either the Nano or Duemilanove, and I use those for prototyping, so I needed a “production” Arduino anyway).
But the MP3 shield uses all but 5 of the digital inputs on the Nano. I’ll need to use 2 of those serial communications with the Arduino controlling the LCD, so that only leaves 3 inputs…
If I use a one-pin-to-one-input I need a lot more: each of the 3 LED button uses 2 (one for the switch and one for the LED itself), so that is 6. The rotary encoders use 2 each (one for forward, one for back) and there are 2 dials, so 4 pins total there. That’s 10. If I want to use the rotary encoder’s “push” function that’s 2 more. I really only need one of the rotary encoder’s push buttons, so let’s say 8 inputs and 3 outputs. I’m short by EIGHT PINS!
Now it turns out that you can use the analog pins (which are normally used for analog inputs like sensors) as digital using the Arduindo’s built-in Analog-to-Digital converter, and the Nano has 8 of them. Whew!, that gives me just enough pins: the 3 digital left over plus the 8 analog pins!
But even better, there is also a method to use a single analog pin and resistors to read a large number of buttons. That will save 2 or 3 pins (depending on if I wire the rotary encoder button to it as well, which I might not, just for simplicity in the wiring).
Between these two methods I should be down to a single analog input for the 3 buttons, 3 digital outputs for the LEDs, 4 digital inputs for the rotary encoders, and one digital input for the encoder button.
Any more inputs and I’ll need a 3rd Arduino or to use a multiplexer that will let me use a larger number of inputs with just a few Arduino pins. Whew!
Update: I realized I was considering the button LEDs inputs, when they are really outputs. I fixed that.
Lots of online sources claim multiple different fonts for the pip-boy.
Here are two of the major contenders prefaced by an in-game closeup of the same text for comparison. First is Gothic 821 BT Condensed (pay) and second is Monofonto (free):
I can’t really imagine Bethesda using a free font, and the kerning/spacing on Gothic looks much better to me…but I’m not 100% convinced. I’ve seen a couple OCR fonts that look really close as well, including one that is already converted for use in the LCD I’m getting. Once I get the LCD I’ll see what that looks like. While I’m totally about authenticity in this stuff, there is diminishing returns: 90% accuracy for little work is more worthwhile that 100% accuracy for a lot of extra work. Time I could spend doing something else on the project…like making the background of scanlines work.
I ordered some parts from Sparkfun which arrived yesterday.
The orange LED buttons I got are too small, and they don’t fit easily on a breadboard because of the arrangement of LED leads. I did get a little breakout board that helps now that a friendly EE soldered it up for me (I really need to get a soldering iron). It’ll at least let me test some things, hopefully.
The rotary encoders I got are “ok” — they may be a bit small, and the “click” when you turn them is pretty weak. They’ll do to start playing with things once I can get them working.
I also got some green EL Wire and the appropriate connectors and inverter for the EL project.