Thursday, 12 December 2019

Box full of lights and buttons (or simon says)

A box full of lights and buttons...


The little lad wanted a box with lights and buttons, so I got some from fleabay for arcade machines.  They were cheap and I was surprised how good the quality of them is.  Each button has a microswitch on the back and an integrated LED with current limit resistor.  Looks like the LED's are set up for 12V operation, they work fine at 9V.

I was going to charlieplex the lot but the processor I was going to use had tonnes of IO so I just wired each switch to a pin and wired each LED to a transistor to a pin.



I used darlington drivers to switch the LED's 'cos I had them and it makes building the board a bit easier.


That's it really, simples!

Saturday, 30 March 2019

IR Remote Control Pop Tin Car

IR Remote Control Pop Tin Car

When I was at school I remember building something like this...


Two cans suspended on a frame driven by a motor and a rubber band.  The kids like making stuff and
drilling holes in wood, so we made this one weekend.  It didn't survive long because once its trundled underneath the sofa and distractions happen, the batterys go flat quickly driving into a stalled motor.  So, more for my enjoyment, I added remote control using an old IR remote.

Now it can go in TWO whole directions, forwards and back under control of the IR Remote.
It also shuts down into low power mode after some time of inactivity.

Schematic of IR Receiver and Motor driver.

The motor is driven by an H Bridge with the load in the collector of the transistors to minimise volt drop.  Each of the H bridge transistors is controlled by the ATtiny44 microcontroller.  The micro and the bridge must be powered from the same supply as there is no level shifting done.

This was built out of junk I had in the box so the power supply to the IR receivier isn't ideal.  The receiver I had shut down below about 4.5V, so to make the most of the battery, the supply is doubled and regulated back down to 5V via that LDO regulator.

Here it is in full action....

Thursday, 6 September 2018

Inductance Meter

Quick Inductance Meter


I needed an inductance meter and had already spent my months spending money so I couldn't simply buy one.  I built one instead.

Luckily I had all the bits I would need to build the meter in the junk box.

Inductance Meter Circuit

The circuit is very simple.  Just an LC oscillator with a known tank capacitor.  The micro counts the oscillator frequency and works out the connected inductance.

The formulae for the resonant frequency of the parallel LC tank is..

f = 1 / (2 * Pi * sqrt( L * C )) 

Rearranged for L is...

L = 1 / (4 * Pi * Pi) * C * ( f * f )

The circuit was cobbled together on a bit of board...

Inductance Meter Circuit

And a window, for the display, CNC'd into a plastic box.




Whoops, n00b, lol.
Clamp, clamp.
Then Clamp some more...


Fixed, nice label :)











I was stressing about powering the thing off a 1.5V battery, but I had a 9V battery and the case takes a 9V battery so I used an XC6202 3V linear regulator to power it.

I added a power button which briefly powers up the device, does a reading and then switches its self off after 10 seconds.

The circuit as built looks like this...

Schematic

Source code and hex file are available here
The meter measures from 1uH to 10mH.

And a quick video showing the operation.



Making that video put me over the budget for this quick project, I had to buy a holder for my camera.


Friday, 13 July 2018

Pressure activated speed controll

Controlling drill speed with pressure

I have a small hand held drill similar to a Dremel.


I need a way of controlling the speed of the drill while I am using it.

I thought some sort of pressure sensor mounted on the drill would allow me to vary the drill speed without needing an external speed controller.

To achieve this I used a piece of silicone pipe mounted on the drill which leads back to a pressure sensor, connected to a PWM power controller.

The pressure reading is taken by the PIC10F320 and converted to a PWM signal, which is connected to a MOSFET, which drives the drill.



Component choice is down to what I had to hand at the time.
Schematic



Wednesday, 28 March 2018

Wired Home Automation

After mucking around with the idea of wireless nodes around the house controlling various things, I dumped the idea and instead ran an RS485 network around the house.

So far I have two temperature and humidity nodes...


The hardware and software are really simple compared to any wireless solution.  These two nodes are polled every now and then and the average temperature in the house is calculated.  This will eventually switch the central heating on and off.

The 'controller' is simply a PC connected to the RS485 network via a bit of hardware.  The hardware does the automatic switching of the RS485 transceiver between Rx & Tx.  There is also a current limited regulator to provide 8V at 200mA.  All this is piped round the house through CAT5 cable.

The PC software is written in JavaScript and executed with node.js.  The user interface is via a browser on any capable device on the IP network.

The two temperature / humidity nodes were installed quickly and I soon required more nodes.  Hand building prototypes is fine but when more units were needed I did a PCB using EasyEDA and ordered them from JLCPCB.  Two weeks later, PCB's arrived.


Nice.  The PCB's were good quality and its not really worth etching boards at home anymore unless you need a PCB within the next few hours!

The PCB contains the RS485 comms stuff and a 5V regulator.  'Functionality' such as the temperature sensors can be added in the 'prototype' area.

The boiler and front house lights require a relay switch to operate them.  Rather than having a relay eating into the power budget of the system I used relays with a coil rated at 12V and ran them at 8V.  The circuit below was used to boost the voltage to the coil at switch on, reducing the coil voltage once it had switched.

Voltage boost relay driver

This circuit provides a voltage pulse of just under twice its supply voltage to the coil.  It also provides a turn off delay, determined by the charging of C1.


Friday, 23 March 2018

Stepper motor speed controller (Tesla coil winder)

I have been wanting to build a tesla coil forever, winding the coil has always put me off.  I think its about time I built one.

I was going to build the coil winder using a drill powered by a 300W, 0 - 40V variable voltage supply.  I built the supply using a variac and large torroid transformer.  The supply worked and is nearly indestructable, then I remembered I had some huge stepper motors...

...so I used those instead.

At least I now have another power supply :)

The stepper motor is driven by a microcontroller (ATtiny2313) with coils driven by mosfet's (BUK9840).  The speed and direction of rotation is varied using a rotary encoder.  The micro spits out information on speed / direction / revolutions on its UART.  The UART connects to an LCD.
The motor coils are rated for 3 volts.  To trade off some torque for speed the motor coils are driven from a 12V supply via some resistors.  These get quite warm in use, the only ones I had with a large enough power dissipation were 25W aluminium resistors, so no trouble there.



I was going to use a shift register to drive the LCD from a couple of pins, but didn't have any.  I have lots of ATtiny2313's so I stuck one on a board with the LCD and used the UART to shift data to the display.  The LCD microcontroller has a 32 character buffer into which any characters received on the UART are stored.  Characters below an ASCII space reset the buffer index to zero.


Very simple, now I've written the code for that it will be useful for other stuff.

To turn the piece of pipe which will be the secondary's former, I made two 'centers' out of the only stuff I had, concrete.  I used two plastic funnels for a mold, which also held the aluminium shaft central while the concrete went off.


Here, the bottom funnel is full of concrete and its stuffed into a bucket of sand while it sets.

The finished winder with first coil secondary.  The two blue concrete 'centres' are holding the piece of plastic pipe.


This only took about 15 minutes to wind, I was expecting to spend at least an hour on it.

Monday, 24 October 2016

USB STK500 AVR Programmer

So, I had one of these AVRISPMk2's for programming AVR's

AVRISPMk2

It was very good.. I was using Atmel Studio 6.  For some reason I upgraded to Studio 7.  I then wasted an entire day messing with various drivers trying to get it working again.  I eventually got everything going again and connected the project I was working on to a 24V power supply, blowing the programmer completely.

I have a working PICkit3 and some PIC16F1455's, so I built a replacement programmer using these parts.  It pops up in windows as a com port and emulates an STK500.  No driver issues there.
The code is based upon a project found here AVR Programmer which I ported over to the PIC and added the necessary code to drive the USB.  As you can see from the below schematic, there isn't much in there.


I have done a PCB and ordered a few in EasyEDA.  The sourcecode can be downloaded here...
https://drive.google.com/open?id=0B0Dxv1kRlKo8MVJwU2tuczJkYmM


Picture of pcb

I can now program my AVR's again :) and if I blow the programmer up, its cheap enough to replace.