Recently I have been learning to use 3d CAD packages so that I can design and build some cases and enclosures for these electronics projects I have been writing about here. I have been using an EagleCad ULP (user language program) called eagleUp …
Last night I retrieved the first chassis printout and did a test assembly with the parts that have arrived. It looks good! The axle distance is perfect, the chunks I carved out for the pi are all the right sizes, and it looks bitchin. The only negative was that the mount for the raspberry pi […]
Before leaving the hackspace on saturday, I set the wheels and motor mounts for my robot printing, as I figured these parts probably wont change while I finish the rest of the design. Tonight, I cleaned up the printed parts, and did a test assembly of the track sets: They looked about right, so I […]
Here is a teaser shot for my new rover robot, based around a raspberry pi and a massive lithium battery. Fairly heavily inspired by Wlll’s ball collecting robot.
Finally it’s time to complete the knock clock! The circuit is complete, working and tested. The firmware for the microcontroller is written and proven to work…so now is the time to put everything into a box and get on with something else. Don’t get me wrong I have had great fun making this project and I am also very interested in making more and possibly making some kits available….
So the picture above shows the PCB top layer with components and dimensions. We can use this to design an enclosure for the project. For quickness and because its so easy I have decided to make a laser cut box out of wood! Laser cutting is the simplest and quickest way I have found to make unit enclosures. As this is essentially a display piece I’ve decided to use laser plywood. I’ll stain and varnish it to give it a good aesthetic appeal. This isn’t really my thing in honesty. I normally just like things to work I don’t care how they look but the customer (she who must be obeyed!) has more stringent criterion…
To design the box ready for laser cutting I used Inkscape an open source graphics package which is awesome -
After installing and setting up the program and checking it was working I then added an extension and this is where designing boxes becomes so simple and efficient – tabbed box maker!
Once installed I then set my page size and limits to A4, Landscape orientation and the grid dimensions to be in millimetres…because I am a shameless Brit and use SI units and paper sizes and I have a working knowledge of those units and dimensions. If you want to use Imperial measurements that is fine too!
Next it’s time to start the tabbed box maker extension:
A window will appear with some options about the box we are going to design.
I saved the file at this point as I wanted to be sure that whatever changes I make from this point I can undo if I needed to. It’s always a good plan!
Next I decided to get clever…In eagle on the PCB layout section I turned all layers off on my PCB view apart from dimensions and holes.
I then exported this image as a PDF. I then imported this image into Inkscape on a new layer. This will allow me to set the laser cutter to drill out the holes for the PCB mounts perfectly aligning them! I then drew some circles over the top of the hole positions and then deleted the PCB image as it isn’t needed. Finally I grouped the holes with the bottom tabbed box shape so they wouldn’t move.
I love getting laser cutters to do all the work for me! Time is precious…
Next we need to add a hole in the side of the box for the DC power Jack. This is a bit more complicated as I don’t have a 3 dimensional representation of the box. I could model this in Google Sketchup but it isn’t necessary…I can guess where the hole needs to be from the dimensions of the DC jack and the PCB layout.
I added all of the components and a dimension from the edge of the PCB to the centre of the DC jack to help…technically not needed. If we draw a line from the DC jack centre across to the left we can position the centre of the hole. Next we draw another like from the edge of the tab section so that we know where the base of the side begins….I know this is difficult to understand hopefully the picture will make it clear:
The red line shows the base of the side when the box will be put together and the blue line shows where the centre of the DC jack plug will be.
What we need to do now is calculate of big a hole we need and where it needs to be positioned. The size of the hole really depends on the size of the plug used. I am using a 12Vdc adapter that I found in my junk pile. I grabbed it and measured the diameter of the DC plug roughly using a ruler. If you are making your own adapter then use the mechanical information from the datasheets! It measured roughly 10mm and to be honest they will all be about this size. So…Hole diameter is 10mm.
Next we need to calculate the height the DC jack will be from the base of the side. This is where things get tricky and some luck is needed. I used a standard DC jack socket on the PCB…I didn’t even look for something specific as it’s a standard part. Here is a datasheet:
From the mechanical information I know that it is 11mm tall and the height to the centre of the jack socket is 6.5mm tall. The PCB thickness is 1.6mm and I intend using PCB stand offs 5mm tall. Therefore if we add the pertinent dimensions together we can calculate where the centre of the hole needs to be:
6.5mm + 1.6mm + 5mm = 13.1mm
So the centre of our 10mm hole needs to be 13.1mm from the base of the side. No problem! Lets add a 10mm hole to our side.
Lets draw another line that is exactly 13.1mm long and overlay it on top of the blue line and beginning at the red line. Then lets add a 10mm diameter circle.
We can then delete the lines and group the hole. Now we have a correctly positioned hole and are ready to cut the wood!
I saved the file with a different name as I will have to cut the material for six parts. One with holes and one without. I decided to add some images to my file to make the box look a little more interesting. The first box I designed was a little plain and boring.
If required I can provide the inkscape files so people can make their own box.
Here is a very quick video of the laser cutter in action:
Now it’s finally time to put the box together. The tabs make it very easy and all that was required was some PVA wood glue and some patience. Once the glue set I put the PCB in the box, I was in a rush so I didn’t use stand offs and the solenoid was secured with blu tac! I will improve my version but I would recommend that people use stand offs and hot glue to secure their solenoid and PCB.
Here is the box!
In order to properly finish up this product I suppose I should provide a bill of materials and some rough costs. So…here goes:
|J1||Programming Header||6x 0.1′ pitch header pins||0.7|
|J2||12Vdc power jack||3.5mm dc power jack||1.15|
|JP1||6 pin Header||6x 0.1′ pitch header pins||0.7|
|JP2||5 pin Header||5x 0.1′ pitch header pins||0.7|
|JP3||5mm Screw Terminal||5mm screw terminal phoenix connector||0.42|
|JP4||5mm Screw terminal||5mm screw terminal phoenix connector||0.42|
|LED1||5mm Red LED||5mm Red LED||0.069|
|R1||10k||1/4W axial resistor||0.018|
|R2||220R||1/4W axial resistor||0.016|
|R3||1k||1/4W axial resistor||0.017|
|R4||100k||1/4W axial resistor||0.017|
|R5||1M||1/4W axial resistor||0.017|
|S1||Microswitch||momentary tactile switch||0.057|
|SP1||Piezo Buzzer||Piezo Buzzer||0.37|
|U1||ATMEGA328P||ATMEGA328P -DIP package||2.01|
|Y1||16MHz||16MHz crystal (through hole)||0.35|
|DS1307||Real time Clock Module||DS1307 RTC module||7.99|
|PCB||Circuit Board||Printed Circuit Board||2.55|
Some of the components have to be ordered in multiples from Farnell Electronics so there would be some items left over and it would not be necessary to order three lots of header pins, one 36 row of pins would be enough. The heatsink is also a little unnecessary for this circuit as the MosFET doesn’t get hot without one. The 12Vdc 5mm screw terminal for the power input could be removed also. If we now recalculate that brings the cost of making this device (not including enclosure) to £16.96
If we add on two sheets of laser plywood (£2.00) and time on the laser cutter (£1.00 for ten minutes) and it took about twenty minutes to cut the enclosure out:
That bring our total costs back up to £21.96!
Not too bad…It would have been nice to get the costs down below £20 and if I searched around for different suppliers I might be able to get some components more cheaply. If I was in the business of manufacturing products I would be searching everywhere for a better deal. I would also redesign the PCB to be smaller, use surface mount components and have the enclosures made in large numbers. This would reduce costs considerably.
Anyway enough of the boring stuff. I had great fun making this project and I probably will get some printed circuit boards professionally made by Seeed Studios. Their fusion service is too good to miss!
Last post we designed a circuit to make a knock clock….Here is the circuit construction process:1. Obtain copper clad circuit board and print out bottom layer reversed on 120gm glossy paper using a laser printer.2. Using a clothes Iron to…
Last night we did more work on our CNC machine, and got the z axis hooked up and working. Just need to add an endstop , fix the y endstops in correctly, extend some wires, and we’ll be ready for our first cut!
A Knock Clock is a electro mechanical clock which tells the ‘knocker’ the time in audible ‘knocks’ to +/-10 minute accuracy. My better half saw one of these recently and asked me to make her one. This is my own implementation based on a circuit made by a member of the Manchester Hackspace – Paul Plowman!
The device itself is a basically a box with some electronics and a device for striking the side of the box to create the ‘knock’ sound. In this case I am using an electromagnetic plunger known as a solenoid. It is normally used to control valves or mechanical devices from an electronic controller. An electro-mechanical relay is essentially made up of a solenoid and a switch. More information about solenoids can be found via the internet and wikipedia!
The basic idea of the circuit is, as with most electronics:
- Take an input (the user ‘knocking on the enclosure).
- Process this input (tell the processor to output the current time).
- Provide some form of output (cause the solenoid to actuate the time in hours and tens of minutes).
In this case the input is going to be sense the user knocking on the enclosure using a piezo buzzer as a simple microphone. Piezo crystals are a useful electrochemical crystalline structure which when force is exerted on the structure a high voltage low current signal is generated. It is the main component used is electric stove gas lighters and certain types of cigarette lighter. More wikipedia below:
Once the input has been detected it is necessary to process this input and then provide an output. To this end I am going to use the ever popular Atmel 328P microcontroller with the arduino bootloader. However I am not going to design a shield this time as I wanted to try to keep the cost of construction down. Using an arduino main board for every project can get expensive – even using clones is becoming expensive! So we have an input which we then need to compare to a known value – time! How does the microcontroller know what the time is? We could set the time on the microcontroller via the serial terminal each time the device is connected to a computer or we could use an ethernet controller and use the same technique; we could hard code the time from when the microcontroller was programmed and use that – best make sure the power is never removed! Or we could use a real time clock…I have decided to use a real time clock as this is in my opinion the best method to use ensuring that the clock keeps reasonable time.
Real time clocks are special integrated circuits which communicate via the I2C protocol directly to the microcontroller and are battery backed up which means that they are constantly powered by a small battery and never lose the time (once it has been set) even if power to the main circuit is removed. The accuracy over time is not always great (they lose a second each month) and the battery normally lasts about 5 years. There are several real time clock modules available to buy and rather than implement the circuit for myself I have bought one of these modules to save time. The real time clock device used in the module is based on the ubiquitous DS1307 by Maxim Semiconductor.
The module I am using was provided by the excellent and very helpful Adafruit Industries:
Now that we have a method of receiving and processing the input it is necessary to drive the output – a solenoid. Solenoids are fairly common devices and can be treated in much the same was as a relay – although a power hungry relay! It often takes a lot of current to drive a solenoid and the circuit will need to provide significant power (voltage and current) in order to make the solenoid actuate. The best way to achieve this is to use a Field Effect Transistor. I have discussed FETS in previous blog posts so I’m not going to go through this again – please read my previous posts.
We need an N-Channel metal oxide silicon field effect transistor ( N-MOSFET) with the following parameters:
There are probably over a hundred devices that meet these requirements. If we do a search using Farnell Electronic’s parametric search facility the following results are found:
We could use any of these N Channel-MOSFET devices and the VGS threshold voltage is the most important parameter as we need the device to work from a 5V digital signal from the microcontroller. As we don’t have any particular preference I am going to choose the least expensive device to keep costs down and the cheapest device is one I already own!
The device I have chosen is the IRF630 by ST Microelectronics – the datasheet is below:
It meets all of the requirements and costs a very reasonable £0.56 from Farnell Electronics.
So….we now have all of the parameters for the Knock Clock decided we can go ahead and design the circuit. I have decided to use a basic implementation of the arduino using an Atmel 328p. The circuit will not have the serial to USB converter or a method of programming the microcontroller so we will have to provide a method of programming and talking to the microcontroller. The rest of the circuit is standard boiler plate electronics – A 12V to 5V linear regulator, a piezo electric speaker (being used as a microphone) and a MOSFET driving a solenoid. The centre header is for the real time clock module. The circuit is shown below:
I have included a six pin programming header to initially ‘flash’ the arduino bootloader onto the microcontroller and a header to allow communication with the microcontroller via a USB to serial cable. The 12Vdc input will be provided via a standard dc barrel jack or via 5mm screw terminals. The output to the solenoid is provided also via 5mm screw terminals.
Here is the PCB layout for the bottom layer:
Here is the top layer with the component identification:
The bill of materials for this project is as follows:
|C3||0.1uF||Electrolytic Capacitor||Capacitor Polarized|
|C4||10uF||Electrolytic Capacitor||Capacitor Polarized|
|C5||10uF||Electrolytic Capacitor||Capacitor Polarized|
|IC1||LM7805||T0220 package||Voltage Regulator|
|J1||Programming Header||6x 0.1′ pitch header pins||6 pin I2C programming header|
|J2||12Vdc power jack||3.5mm dc power jack||Power Jack|
|JP1||6 pin Header||6x 0.1′ pitch header pins||Serial Communications Header|
|JP2||5 pin Header||5x 0.1′ pitch header pins||RTC Header|
|JP3||5mm Screw Terminal||5mm screw terminal phoenix connector||12Vdc input from screw terminals|
|JP4||5mm Screw terminal||5mm screw terminal phoenix connector||Solenoid output from MOSFET|
|KK1||Heatsink||T0220 Heatsink||Heatsink for MOSFET|
|LED1||5mm Red LED||5mm Red LED||Power LED|
|Q1||IRF630||MOSFET N-CHANNEL||Common logic level MOSFET|
|R1||10k||1/4W axial resistor||Resistor|
|R2||220R||1/4W axial resistor||Resistor|
|R3||1k||1/4W axial resistor||Resistor|
|R4||100k||1/4W axial resistor||Resistor|
|R5||1M||1/4W axial resistor||Resistor|
|S1||Microswitch||momentary tactile switch||Momentary Switch for reset|
|SP1||Piezo Buzzer||Piezo Buzzer||Piezo Buzzer used as a microphone|
|U1||ATMEGA328P||ATMEGA328P – DIP package||Microcontroller with arduino bootloader|
|Y1||16MHz||16MHz crystal (through hole)||16MHz Crystal for microcontroller|
Tonight we had our 4th CNC night. We rebuilt the Y axis of the proxxon mf70 mini mill we’ve been converting using a 3d printed bubblegumcnc kit. After building the axis, We hooked up our GRBL shield and managed to get the machine moving the X and Y axes properly under its own power. We […]