Posts

Multiple Buttons and LEDs

Image
Yesterday's post showed the making of this little two button remote control  so it seems only right to to include it in this post about reading multiple buttons. It's just two simple buttons that pull the data line down to ground when pressed and could easily be recreated on the breadboard if required. We're also going to talk about multiple LED's and set up the framework for using multiples even though the we're only going to using the one built in LED again. The main difference between this program and the previous one is that the inputs and outputs are going to be defined as arrays of values instead of just single values. Right at the top of the program it's important to define how many inputs and LED's there around going to be and then create an array of values to declare which data lines these things are going to be on, in this instance D1 and D2 and the same LED as before. even though there is only one LED we can still define it in an array. Now when...

Two Button Remote Control

Image
Next on the list of achievable items was this little two button remote control. This hides inside the puzzle box until it is released by the player and is used to navigate a mouse around a maze on the top of the box. There are two tactile switches hidden under the brass chicago screws so that it makes a very satisfying and positive click when pressed. There are actually seven layers of 1.5mm material that go into these controls and that allows me to build up a compartment that is a perfect height for the buttons and also a captive area for the screws so that they don't fall out. The general size was a bit of a trade off, it had to be quite small to fit inside the compartment but still a sensible size to click. The arrows were engraved onto the top layer of material but they weren't very visible so I added some smaller brass labels which show the button function much more clearly. Inside the remote are two surface mount, low profile, tactile switches. The connections are first h...

Leather handles Jig

Image
  I made the first two handles with a lot of brute force and effort but after finishing them I didn't like the stitching, I should have used a backstitch rather than a running stitch so I had to go back and fill in the gaps. This meant that the actual stitching was taking around three and a half hours per handle. I realised the stitching went faster around the wooden handle area so I quickly cut out a wooden section that runs the whole length of the handle. This holds the leather more firmly and allows me to use the vice to hold the work, it now takes just over two hours to finish a handle, so just ten more hours of sewing to go. The handles are mounted to the very top of the box and can be used to lift the whole thing. These handles are still waiting on some longer screws to affix the wooden section to the middle.

How to Read a Switch

Image
So far we've covered how to blink an LED on and off and how to flicker an LED using an analogue output value, it's time to start reading and reacting to inputs to the controller. This means adding some additional hardware to read from, but today that can be a simple as a single wire on a prototyping breadboard. One end of the wire is connected to the D1 input and the other end is swapped between the 3V3 pin and the GND pin to create High/Low input signals. The initial code to read this is impressively simple, we're also going to leave some LED code in the demo so that we can easily see what value is being read by the controller. When you load this example you should see that the LED turns on when the wire is connected to GND (remember the LED_BUILTIN is active low) and the LED turns off when the wire is connected to 3V3. This system works but has a downside, the input pin only changes state when the wire is connected to the new pin. When the wire is disconnected and l...

Hand Stitched Leather Handles

Image
The NikolAI box come supplied in a wooden packing crate for safe transport so the first thing players need to do is lift the puzzle box clean out of the packing crate. For this purpose there needed to be a sturdy handle on the top of the box for lifting. I couldn't find anything even close to the right length so I made my own and hand stitched it. I'm very much regretting this choice now that I have to make ten more boxes but I'll survive. The handle is made from several layers, two pieces of leather sandwich some 0.8mm polypropylene. This gives the handle stiffness and strength. I used the laser to punch a line of holes around the edge of leather which I use to stitch along, it keeps the stitching straight and evenly spaced. Two wooden panels sandwich the leather to provide a nice flat handle section. This is screwed into place using countersunk screws so everything sits flush inside the handle  

Skinny Useless Machine

Image
  Right at the heart of the Nikol-AI box there is a Useless machine  hidden inside a secret compartment that appears at the very end of the game. I tried long and hard to make a standard machine fit in the space available but in the end I had to make the whole box skinnier by about 9mm. The useless machine drops into the box from it's compartment so I actually had to move the batteries inside the machine to ensure that it drops without flipping over. The new location has the weight of the batteries spread evenly across the width but also at the top of the box so the drop helps it slide out towards the front of the compartment. Chris was suitably impressed with the reveal  to the point where he had to explain that it wasn't just tv trickery.

How to Flicker an LED

Image
In the last tutorial we covered how not to blink an LED , where I explained what was wrong with the most common blink example and showed a much more elegant solution. We now have an LED that switches between 'Off' and 'Blindingly Bright', there has to be another way that gives us more control over the LED, reduces the brightness (and therefore power consumption) and that could also give us a bit more 'character' for our lights. The answer is Pulse Width Modulation , or PWM for short. By switching the LED power on and off, imperceptibly quickly we can control the average amount of Voltage that is supplied to the LED, which in turn reduces the current and brightness of the LED. If we switch the power on and off faster than the LED can react, the LED will receive an average Voltage that is proportional to the ratio between on and off. If the LED is on for half the time and off for half the time it will receive half of the full voltage. It is possible to create the...