Making an Arduino sleep (to conserve power). Looks useful: http://code.google.com/p/narcoleptic/
I’m still using the 50% duty cycle circuit from the NE555N datasheet, except that R1 is 53K and C1 is 100nF.
I’ve taken that output into a low pass filter: the signal comes through a 10K resistor into the scope, and there’s a 10nF capacitor going to ground.
As expected, with a 139.7Hz input signal, the attack and decay are slowed down a little bit:
Increasing the input signal increases the effect:
Increasing the input signal further to 26.1Khz gives a nice
saw triangle wave:
And increasing it ridiculously produces a DC signal:
I’d like to have made a better
saw triangle wave but I don’t have the right value of capacitor for the 555 circuit. However, increasing C1 to 231nF (7x33nF) and setting the input signal back to 139Hz produces a lovely one:
And a very similar wave is produced by setting C1 back to 10nF and increasing R1 to 220K:
This is explained by something called “maths“, but I’m happy enough to see that changing either one works. Afrotechmods suggested selecting the value of R1 to suit the load on the output signal, and changing C1 to get the appropriate wave. Which seems sensible.
Switching the positions of R1 and C1 gives a high pass filter, and as expected, produces the following wave:
In the process of making a silly mistake, I also found that leaving R1 out made the wave much tidier, completely getting rid of the ramping down and up that I couldn’t get eliminate in the 555 circuit! Neat:
Though, as you would expect from a high pass filter, the peaks and troughs are no longer quite flat. I’m not sure how to expect a high pass filter to behave without R1, so I don’t really know if this is meaningful or useful.
Anyway, decreasing the input signal to 78Hz produces a more pronounced change:
As does decreasing C1 to 1.4nF (3x470pF):
Decreasing C1 to 1pF gets us back to DC:
As does decreasing R1 to 10R:
However, I couldn’t quite get it back to DC by passing in a lower frequency wave. I made the filter a bit more aggressive by changing R1 to 100K, and passed in 12.5Hz. But no matter how low the frequency, there are always upwards and downwards spikes when the input signal changes from high to low, or vice versa:
I think I’ll leave that mystery for another day.
Inspired by Afrotechmods, I thought I might try experimenting with RC filters and wave generators. I bought a second probe for my scope so I can see the input and output signals at the same time (neat).
Since I don’t have a signal generator, I thought a good start might be to try making a 555-based circuit that generates a square wave to pass into some filters to see what happens. I did wonder about doing this with an Arduino, but that seems like cheating. And it would be good to get into the habit of doing things in hardware when I can, instead of going straight to a microprocessor.
I’ve also wondered before about producing a 50% duty cycle from a 555, which isn’t something I’ve done — an astable always seems to be more one way than the other, and I’m not sure why. From Wikipedia, I learned that the duty cycle is described as a percentage, where the percentage is the time the signal is high. It can therefore be calculated as:
D = a / P
Where D is the duty cycle, a is the time the signal is active, and P is the period of the wave.
To start with I built the 50% duty cycle circuit from the NE555N datasheet. I don’t have any 51K resistors (which sounds like an odd value) so I used a 47K. Perhaps predictably, the resulting wave was not 50%:
Experimenting with the value of C1 produced the results I would expect. With 4.7nF:
With 4.7 and 10nF in parallel:
As expected, the frequency decreases as the value of C1 increases, and the duty cycle stays constant (ish). Less expectedly, the wave is not particularly square. Here is the 50KHz calibration signal from the scope for comparison:
In any case, one thing at a time. The 50% duty cycle might be caused by not following the instructions from the datasheet, so I strung together a 47K and 4 1K resistors to get to the magic number. With C1 at 10nF:
This is much closer to 50%, but also rather less square. Guess: the higher resistance is causing the cap to charge more slowly, leading to that slower ramp-up. Let’s try a 100K and see how that looks:
Guess not. The edges are now more similar to the ones with lower values for R1. *confused*. Looking back over the earlier pictures, I think that ramp-up/down actually gets a bit worse as C1 increases. Which does make sense if C1 is taking longer to charge. Changing C1 to 100nF does back this up a bit:
So I guess it’s some mixture of R1 and C1 that I don’t understand. Gratifyingly, though, those last two pictures show clearly that altering C1 alters the frequency without changing the duty cycle (much), and it looks like that that relationship is linear: multiplying C1 by 10 gave a value of p 10 times greater.
Anyway. I set kept C1 at 100nF, put R1 back to 51K and added two more 1K resistors, bringing the total up to 53K, and that gave me exactly a 50% cycle:
Good enough, I think, despite the not-quite-squareness.
I wondered then if the values in the datasheet are correct (which seems likely) and if it’s just the low tolerance on these resistors that’s accounting for the difference. So I measured the actual values of R1 and R2 which were 52.3K and 22.24K respectively. I guess it’s not those then. I swapped out the 555 for a different one in case that was damaged or the tolerances there could make a difference. Nope. The value of C1 doesn’t affect the duty cycle very much, so it’s probably not that. And I can’t measure that. So it’ll have to be a mystery.
Next: adding low- and high-pass RC filters.
I finished those improvements to Captain Quack, but, like an idiot, I forgot to take pictures of the changes. Again. And it blew up. Again. This time, though, I did get a video:
Pleasingly, the damage wasn’t nearly as bad this time. The end panels were completely undamaged, so those bigger vents definitely worked. The front and back panels were damaged but not as badly as before, and the bottom panel and top compartment were completely fine. The pyro did blow a hole through the mesh on the end vent, though. So I guess that mesh is not strong enough:
I am sure that it’s a good idea to keep working on making the box work well with Mk9 pryo, though. It makes a fantastic bang and is very theatrical. Mk5s are totally weedy by comparison. For version 3, then, I’ll be making some more changes:
- I’m going to extend the final warning period a bit. 3 seconds isn’t quite long enough for people to get clear
- I’m going to make the make the switch on top more robust. Although briefed to be gentle, players always belt the shit out of it, and I think the adrenaline makes that unlikely to be avoidable
- I’m going to make vents on the front and back of the box, the same as are on the ends, and use much more robust mesh
- I’m going to go over the code and test it very thoroughly to make sure no more gremlins creep in — there was a bug with the button during the game.
Some more photos:
I’d like to start making PCBs instead of using stripboard. Stripboard is horrid.
I think the easiest approach for me will be to expose the board to UV through a transparency printed on an inkjet. Because there’s an inkjet in the house, and I think that’s how we used to do it at school.
It seems fun to make my own UV box for this, from LEDs. Useful things about that:
- Forum post from a guy who did it
- Decent price on UV LEDs in bulk. Farnell have no through-hole UV LEDs in stock. wtf?
- Clever wizard for designing an optimal matrix with a given type and number of LEDs
- Wikipedia page on UV, which cleared up some confusion over the exact difference between UV-A|B|C (wavelength) and whether one or more of them might be filtered out by a given UV LED (no).
On the subject PCBs in general:
- This guy does what I’d like to do
- Eagle PCB, which you can use to design the layout, and which can make a layout for you. Mamazing.
I will need:
I already have a printer, Sodium Hydroxide and acetone.
While building a project with a 4×7-segment display, I was irritated by how many pins needed to be used just for the display. I barely had enough to be able to complete the project.
So I looked into methods for controlling an LED matrix with fewer pins. I learned about Charlieplexing, which seems interesting but non-trivial. Then I found the MAX7221 IC, and an Arduino library to interface with it. Perfect. I bought some to try out and they’re very easy to use. Though the display I was using would not run on USB power — I had to connect it to 7.5V from my bench supply.