With our new boards designed, it was a relatively painless task at last night's BuildBrighton's Open Evening to knock out a PCB and mdf top layer for our new layout.
Because our shift registers are cascading, we can actually test (part of) the board by simply soldering on a few parts - the PIC microcontroller, maybe a shift register or two, pull-up resistors and some hall effect sensors.
In fact, so long as we have just one shift register, all the pull-up resistors on that register, and the PIC microcontroller, we can start to test as we go: reading the data in over the SPI lines should, at the first instant, return b11111111 (since all the lines on the shift register inputs are being held high thanks to the pull up resistors). Then as we introduce each hall effect sensor, we can test it's performance, looking for a zero in the incoming data from the shift register, at the point where a magnet is placed over the sensor. Once we've tested one shift register, we can simply add the next one "higher up the chain" and repeat - allowing us to test each individual component as it is added to the board.
This may seem like a slow, long-winded way to test our new board design, but - in the event of a problem - it will also allow us to immediately identify any offending component as soon as it is added to the board: a really useful thing to be able to do on a first-time prototype!
Of course, we're fully expecting everything to just work, first time, with no cock-ups, oversights or mistakes. And if, by some miracle, it does, then we've already got our artwork prepared for making a silkscreen for screen printing.
We're finally happy with our chosen board design - the entirely surface mount approach means that we don't have to worry about constructing a tray or enclosure for the lower-half of each board section. We don't have to worry about drilling the board and getting the pcb design to line up perfectly with the holds. And using this new design means that the underside of our single-sided copper board is simply the bottom of each board section. Keeping the design single-sided also means we're more than capable of producing a reasonable volume of boards ourselves (rather than get double-sided boards professionally manufactured) relatively quickly and we can produce more on demand, as the need arises.
We've had an ingenious idea for a semi-automated pick-n-place machine (more on this in a later post) so all that remains is to sort out the top/mdf layer for each board section. At the minute, we're laser cutting the top layers from 3mm mdf
This is actually quite a slow process. Although the laser cutting only takes 3-4 minutes, this does mean that to make any kind of volume of boards limits us to about twenty per hour.
And to produce 20 mdf layers in an hour means that the laser cutter is going to be working flat out, without a break. That's going to have a serious impact on the laser tube; and it's quite likely that we're not going to be able to keep that rate going for very long, as the tube gets hot and the cooling water needs chance to cool down.
While our new layout for the top layer fits our shift-register-based board really well, and the recesses for the 3-pin connects make the edges look nice and neat, we're going to have to consider an alternative to laser cutting sheets of mdf - both in terms of speed and appearance.
We're also going to need to consider using a slightly thicker material than 3mm - even if just by 1mm or so - because of our surface mounted crystals. They protrude ever-so-slightly over the lip of the laser cut mdf, when placed on the pcb.
While it is possible to source alternative/lower profile crystals, this also adds to both the cost and availability of sourcing our components - where possible we're trying to stick to easily sourced parts. We could also stick with our 3mm thick top layer and introduce a pocket on the underside of the graphic layer, but this is just complicating things unnecessarily. Better to just stick to a slightly thicker layer, and make sure that all components are completely covered by it, when it is in place.
Foam board is a relatively inexpensive material for making our top layers.
It's not only cheap, but easy to cut (the laser cutter can be run at a faster speed than mdf and still get a decent cut). It's also readily available from a number of sources, and comes in both 3mm and 5mm thicknesses.
Hindleys, for example, sell a pack of 10 sheets of 508mmx762mm foam board for £21.45
Since our board section is 200 x 150, we can get 9 pieces per sheet, or 90 board section pieces for £21.45. Even allowing for VAT at 20% this works out at less than 30p per board section. Not at all bad!
It may also be possible to die cut. And it's this reason why we're giving it some serious thought: to be able to punch out the outline and all the internal holes with a single stroke would be a very quick way to produce this top layer for our board game sections. Of course we'd either need to build a die cutting punch, or pay for a cutting service (on top of a one-off charge to get the die made) but it does offer up an intriguing method of producing a relatively large volume of pieces, very quickly.
For now we'll keep that idea on the back-burner: we've a PCB to finish soldering up and some testing to do first!
Friday, 23 May 2014
Wednesday, 21 May 2014
New PCB designs for electronic board game
A while back we got a working prototype of our electronic board game, in the form of a "set-in-space-dungeon-crawler". It worked quite nicely, but as we talked to other tabletop gamers, it became apparent that a generic gaming system would have a much wider appeal (not everyone is a sci-fi/Warhammer 40K fan!)
So we set about making a series of generic 6x8 board sections, which could be arranged in any number of ways: in a 3x2 arrangement to create a playing surface 12 x 24 squares in size (perfect for a football/sports pitch, meaning we're eventually getting close to creating our electronic Blood Bowl game that was started so many years ago!) or even a 6x1 arrangement, to create a big long 8 x 36 grid which could be used as a Wild West town, complete with model buildings along each long edge.
Our original design used two 16F883 PIC microcontrollers, each with 28 pins. Allowing for power, ground and data lines, this gives us 24 i/o pins on each mcu, for a total of 48 for each 6x8 board section.
Now we're using software serial (bit-banging) for data transfer, and the internal oscillator on the chip, running at 8Mhz. During testing, everything has worked fine. But there's just a nagging feeling that this might not be quite good enough for a production board: in the past we've had problems with software serial on a 16F628 running on its own internal oscillator - after a few minutes (and particularly if the chip is face down on the table with no ventilation, so the ambient temperature can rise over time) the bits of data can drift, giving inaccurate readings.
When we had problems like this in the past, they were fixed quite easily by adding a crystal to the mcu. But we don't have any spare pins to add a crystal to each mcu on our board sections - all our pins are used for i/o lines!
The answer?
PISO shift registers!
The 74HC165 is a parallel in serial out (PISO) shift register. It can be used with similar shift registers, and they can all share the same clock and latching lines, while the data can be cascaded from one shift register to the next.
After four or five attempts, we've finally got a board design that
a) we're happy with
b) uses only surface mount parts (so the back of each board section is completely flat and requires no additional enclosure to be built around the pcb)
We're using the original connector idea, only this time we need only three pins. In our earlier version, we used five pins, so that each socket was symmetrical (a mirror image on both sides) which allowed the different board sections to be placed in any orientation. To keep things simple, with this design, we're going to force all boards to be placed the same way around - the easiest way to achieve this is to place the connectors slightly off centre. Once we know that boards can only be connected a certain way around, we don't need the extra pins and can keep the connectors down to just 3 pins, instead of five.
Of course, a new board layout means a new mdf laser cutting template, with extra holes for all those shift registers:
With these designs complete, we're ready for the next BuildBrighton open evening, to have a go at laser etching the board(s) and laser cutting the mdf, to give this new design a trial run. If all goes well, we might even make this the first design that we have a go at screen printing, once we've got our new space at the Boiler Room Studios up and running!
So we set about making a series of generic 6x8 board sections, which could be arranged in any number of ways: in a 3x2 arrangement to create a playing surface 12 x 24 squares in size (perfect for a football/sports pitch, meaning we're eventually getting close to creating our electronic Blood Bowl game that was started so many years ago!) or even a 6x1 arrangement, to create a big long 8 x 36 grid which could be used as a Wild West town, complete with model buildings along each long edge.
Our original design used two 16F883 PIC microcontrollers, each with 28 pins. Allowing for power, ground and data lines, this gives us 24 i/o pins on each mcu, for a total of 48 for each 6x8 board section.
Now we're using software serial (bit-banging) for data transfer, and the internal oscillator on the chip, running at 8Mhz. During testing, everything has worked fine. But there's just a nagging feeling that this might not be quite good enough for a production board: in the past we've had problems with software serial on a 16F628 running on its own internal oscillator - after a few minutes (and particularly if the chip is face down on the table with no ventilation, so the ambient temperature can rise over time) the bits of data can drift, giving inaccurate readings.
When we had problems like this in the past, they were fixed quite easily by adding a crystal to the mcu. But we don't have any spare pins to add a crystal to each mcu on our board sections - all our pins are used for i/o lines!
The answer?
PISO shift registers!
The 74HC165 is a parallel in serial out (PISO) shift register. It can be used with similar shift registers, and they can all share the same clock and latching lines, while the data can be cascaded from one shift register to the next.
After four or five attempts, we've finally got a board design that
a) we're happy with
b) uses only surface mount parts (so the back of each board section is completely flat and requires no additional enclosure to be built around the pcb)
We're using the original connector idea, only this time we need only three pins. In our earlier version, we used five pins, so that each socket was symmetrical (a mirror image on both sides) which allowed the different board sections to be placed in any orientation. To keep things simple, with this design, we're going to force all boards to be placed the same way around - the easiest way to achieve this is to place the connectors slightly off centre. Once we know that boards can only be connected a certain way around, we don't need the extra pins and can keep the connectors down to just 3 pins, instead of five.
Of course, a new board layout means a new mdf laser cutting template, with extra holes for all those shift registers:
With these designs complete, we're ready for the next BuildBrighton open evening, to have a go at laser etching the board(s) and laser cutting the mdf, to give this new design a trial run. If all goes well, we might even make this the first design that we have a go at screen printing, once we've got our new space at the Boiler Room Studios up and running!
Relay timer controller for 240v main with a PIC, max7219 and 4-way 7 segment display
This is a simple timer/relay controller; it's for our UV exposure unit, but could easily be used as a countdown timer to switch any 240v mains load (up to 5A or 10A depending on the type of relay used).
The idea behind it is pretty simple - the interface consists of four buttons and a 4-way 7-segment display. Two of the buttons are for minutes and seconds, the other two buttons are for up/down (plus/minus). Hold down the appropriate minute or hour button, and press the plus/minus buttons to increase/decrease the amount of time on the display.
While the display is showing a time, the relay is activated and the 240v mains load is switched on. Every second, the time decreases. When the time reads zero, the relay is released, and the 240v load is switched off.
We did consider having a large "go" button but eventually decided it was unnecessary. As long as the time on the display is above zero, the relay will activate and switch on the mains 240v load. So as soon as you start to enter a time, the relay will switch on our UV lamps, for example. As soon as you release both the hours and minutes button for more than one second (to indicate that the time has been set) the countdown timer begins.
While this does mean that the timer is on for maybe a few seconds more than actually shown on the screen (if you spend 5 seconds setting the time to 2min 30sec, for example, the unit is actually activated for 2m 35 seconds) it also means we have an important fail-safe for our UV exposure box - namely that we can't end up with a scenario where the UV lamps are switched on and the countdown timer is not running (which could, potentially, lead to massive over-exposure of our UV sensitive paints).
We're quite happy - for this project at least - to compromise a little accuracy for ease-of-use and to simplify the hardware design slightly.
The idea behind it is pretty simple - the interface consists of four buttons and a 4-way 7-segment display. Two of the buttons are for minutes and seconds, the other two buttons are for up/down (plus/minus). Hold down the appropriate minute or hour button, and press the plus/minus buttons to increase/decrease the amount of time on the display.
While the display is showing a time, the relay is activated and the 240v mains load is switched on. Every second, the time decreases. When the time reads zero, the relay is released, and the 240v load is switched off.
We did consider having a large "go" button but eventually decided it was unnecessary. As long as the time on the display is above zero, the relay will activate and switch on the mains 240v load. So as soon as you start to enter a time, the relay will switch on our UV lamps, for example. As soon as you release both the hours and minutes button for more than one second (to indicate that the time has been set) the countdown timer begins.
While this does mean that the timer is on for maybe a few seconds more than actually shown on the screen (if you spend 5 seconds setting the time to 2min 30sec, for example, the unit is actually activated for 2m 35 seconds) it also means we have an important fail-safe for our UV exposure box - namely that we can't end up with a scenario where the UV lamps are switched on and the countdown timer is not running (which could, potentially, lead to massive over-exposure of our UV sensitive paints).
We're quite happy - for this project at least - to compromise a little accuracy for ease-of-use and to simplify the hardware design slightly.
Friday, 16 May 2014
Creating a screen printing UV exposure unit from acrylic nail art lamps
Some of the nerds have recently acquired space at the Boiler Room Studios in Hove - somewhere big enough to do some soldering, laser cutting, and - hopefully - some screen printing!
At the heart of any screen printing is a UV exposure unit. This allows an image (whether hand-drawn, printed, or photocopied) to be transferred onto the silkscreen for printing. By applying a photo-sensitive film to the screen, and using the image as a photo-resist (similar to how we use car paint as an etching mask for our PCBs) the UV exposure unit creates a hard, thin stencil on the silkscreen.
As well as using ultra-violet light to create an image on a screen for silkscreen printing, it will also be really useful for exposing and hardening off UV curable solder-mask paint. So we get two different uses from the same bit of kit!
In our new studio space we have a large office desk, which forms the base of our screen-printing exposure unit. Simply put, we're cutting an A3 sized hole into the desktop (in the larger, left-hand side of the desk) and covering this with glass. Under this glass, we'll have a tray holding a number of ultra-violet (UV) lights.
In fact, we'll probably add a few plain while bulbs (or maybe some LEDs) and the whole thing could also be used as a lightbox to help with alignment and for tracing images. A real three-in-one-bit of kit!
We've read reports of people having success using acrylic nail "drying" lamps for photo-resist processing, as each unit has four 9W flourescent UV bulbs - removing the need to create complex balast-balanced circuits to get a bare UN bulb to light up. As they cost about a tenner each on eBay, and because we're aiming for a larger-than-A4 exposing area, we bought three.
They're pretty simple devices, which means they'll be easily hackable! Each one has a timer button, which runs the lamps for 2 minutes (120 seconds) exactly. They also have a flick-switch to make them always on. The units are surprisingly large. The photos on the internet don't really have much to give an indication as to their actual size. For some reason (maybe the price) we were expecting them to be physically smaller.
Each unit comes with 4 x 9W UV bulbs, marked as 365nM (although the instructions specifically say that the UV light is safe to look at, but recommends avoiding prolonged exposure to the eyes) has a removeable bottom plate and a cheap, plastic enclosure.
A few screws hold the top and bottom parts together. After opening, care needs to be taken in case the wires connecting the base to the lid are snagged (some of the wires were wrapped around each other on this unit).
The components on the lid are simply a push-button switch and a toggle switch, which can easily be re-sited elsewhere. The lamp holders are part of the moulded plastic enclosure and are not removeable - we're going to need to cut the lamp holder parts out of the plastic to keep them intact and make them reuseable.
As we have three of these, to make a single UV exposure unit, the centre-pole and the "always on" pole of the toggle switch can be shorted together (so each device is always switched on when plugged in) and the 120 second start button simply unplugged from the board. We're powering all three from the same single power supply (a single lead with a 240v mains plug), but keeping the individual fuse on each unit, just in case.
This single power supply will be switched via a relay, which allows us to create a PIC-based timer module to set the exposure time (for all 12 lamps together) in minutes and seconds, rather than have to switch each bank of 4 lamps individually.
We've already built a timer module (for an earlier LED-based UV exposure unit which worked, but was not very big) but that's slightly more than we need for this project. A simple relay switch with 7-segment countdown timer should suffice for this, since we're only having the one setting (full power). Which means we need to get all three of our individual units working from a single power supply.
The first job is to make a tray into which we can mount our UV bulbs and electronics. At BuildBrighton, this means grabbing the first bit of left-over sheet ply and some 1" x 2" battens and knocking together a simple tray.
We made sure that the height of the sides is high enough for the height of the UV lamp holders, chopped up some strips of pine that were lying around and screwed the whole thing together (no nails were harmed in the making of this wooden tray!).
Next, we needed to get the UV controllers out of the nail drying units. UV flourescent bulbs are not as straightforward as regular lamps or LEDs - you can't just put power to them and expect them to switch on. Each bulb needs complicated ballast control and to be balanced properly, so we just lifted the circuitry that came with the nail drying machines out of the enclosure and made a few simple modifications.
After putting a probe on the 3-way switch (with the unit unplugged from the mains of course!) we discovered that in the middle (off) position the incoming (blue) neutral line is disconnected, and it simply shorts this to either the orange wire (always-on mode) or the black (120 second timer mode) as the switch is toggled.
Since we're going to control the on/off times of the entire unit (once it's built) we removed the switch and shorted the incoming "neutral" line from the 240V to the orange wire (so that the device acts as if it is in the always-on position). The other part shown in the photo above (connected to the incoming, brown "live" wire) is a fuse holder with a 3A quick-blow fuse fitted. We decided to keep this in place as an extra safety precaution (messing about with 240V mains can be both scary and dangerous, so always treat it with respect!)
One problem with the nail units is the use of cheap, vac-formed lamp holders, integrated into the large white housing. Grumpy Paul showed how to cut these free properly - not just going at them with a hacksaw as originally proposed, but to score around each lamp holder with a sharp blade, and them snapping them free from the surrounding material.
To make sure we were along the right tracks, we connected just two (of the three) modified devices together, using a bank of screw terminals fixed to some strip/vero board, and fired it up....
Success! All eight bulbs lit up first time. Things already look very promising! By simply repeating the whole process for the third and final nail drying unit, we got all 12 bulbs connected and running from a single 240V power supply:
Now for some quick maths: each bulb is rated at 9W (these are flourescent bulbs after all, which are much less power-hungry than traditional tungsten filament bulbs). So we have 12 x 9W = 108W (plus perhaps a few mW for the logic control on each of the boards which is insignificant in the grand scheme of things). Not much more than a single, bright, filament-based light-bulb.
Since power = current * voltage, we can re-arrange this formula to get current = power / voltage. Which means our unit is likely to draw 108/240 = 0.45 amps.
Even using the single plug from just one of the units, and a single fuse for the entire set of three controllers, we're well under the 3A rating of the quick-blow fuse (and the fuse in the mains plug). So no further modification is required - we should be just fine running our new UV exposure unit from a single socket, exactly as it it (ok, maybe we need to reposition a few of those lamps!)
Being able to switch the entire set of UV bulbs on and off from a singe power source means we can now get on with building our own PIC-controlled timer/relay unit, two switch the entire thing on and off, and allow us to set an exposure time to the nearest second. Perhaps that's for another post......
At the heart of any screen printing is a UV exposure unit. This allows an image (whether hand-drawn, printed, or photocopied) to be transferred onto the silkscreen for printing. By applying a photo-sensitive film to the screen, and using the image as a photo-resist (similar to how we use car paint as an etching mask for our PCBs) the UV exposure unit creates a hard, thin stencil on the silkscreen.
As well as using ultra-violet light to create an image on a screen for silkscreen printing, it will also be really useful for exposing and hardening off UV curable solder-mask paint. So we get two different uses from the same bit of kit!
In our new studio space we have a large office desk, which forms the base of our screen-printing exposure unit. Simply put, we're cutting an A3 sized hole into the desktop (in the larger, left-hand side of the desk) and covering this with glass. Under this glass, we'll have a tray holding a number of ultra-violet (UV) lights.
In fact, we'll probably add a few plain while bulbs (or maybe some LEDs) and the whole thing could also be used as a lightbox to help with alignment and for tracing images. A real three-in-one-bit of kit!
We've read reports of people having success using acrylic nail "drying" lamps for photo-resist processing, as each unit has four 9W flourescent UV bulbs - removing the need to create complex balast-balanced circuits to get a bare UN bulb to light up. As they cost about a tenner each on eBay, and because we're aiming for a larger-than-A4 exposing area, we bought three.
They're pretty simple devices, which means they'll be easily hackable! Each one has a timer button, which runs the lamps for 2 minutes (120 seconds) exactly. They also have a flick-switch to make them always on. The units are surprisingly large. The photos on the internet don't really have much to give an indication as to their actual size. For some reason (maybe the price) we were expecting them to be physically smaller.
Each unit comes with 4 x 9W UV bulbs, marked as 365nM (although the instructions specifically say that the UV light is safe to look at, but recommends avoiding prolonged exposure to the eyes) has a removeable bottom plate and a cheap, plastic enclosure.
A few screws hold the top and bottom parts together. After opening, care needs to be taken in case the wires connecting the base to the lid are snagged (some of the wires were wrapped around each other on this unit).
The components on the lid are simply a push-button switch and a toggle switch, which can easily be re-sited elsewhere. The lamp holders are part of the moulded plastic enclosure and are not removeable - we're going to need to cut the lamp holder parts out of the plastic to keep them intact and make them reuseable.
As we have three of these, to make a single UV exposure unit, the centre-pole and the "always on" pole of the toggle switch can be shorted together (so each device is always switched on when plugged in) and the 120 second start button simply unplugged from the board. We're powering all three from the same single power supply (a single lead with a 240v mains plug), but keeping the individual fuse on each unit, just in case.
This single power supply will be switched via a relay, which allows us to create a PIC-based timer module to set the exposure time (for all 12 lamps together) in minutes and seconds, rather than have to switch each bank of 4 lamps individually.
We've already built a timer module (for an earlier LED-based UV exposure unit which worked, but was not very big) but that's slightly more than we need for this project. A simple relay switch with 7-segment countdown timer should suffice for this, since we're only having the one setting (full power). Which means we need to get all three of our individual units working from a single power supply.
The first job is to make a tray into which we can mount our UV bulbs and electronics. At BuildBrighton, this means grabbing the first bit of left-over sheet ply and some 1" x 2" battens and knocking together a simple tray.
We made sure that the height of the sides is high enough for the height of the UV lamp holders, chopped up some strips of pine that were lying around and screwed the whole thing together (no nails were harmed in the making of this wooden tray!).
Next, we needed to get the UV controllers out of the nail drying units. UV flourescent bulbs are not as straightforward as regular lamps or LEDs - you can't just put power to them and expect them to switch on. Each bulb needs complicated ballast control and to be balanced properly, so we just lifted the circuitry that came with the nail drying machines out of the enclosure and made a few simple modifications.
After putting a probe on the 3-way switch (with the unit unplugged from the mains of course!) we discovered that in the middle (off) position the incoming (blue) neutral line is disconnected, and it simply shorts this to either the orange wire (always-on mode) or the black (120 second timer mode) as the switch is toggled.
Since we're going to control the on/off times of the entire unit (once it's built) we removed the switch and shorted the incoming "neutral" line from the 240V to the orange wire (so that the device acts as if it is in the always-on position). The other part shown in the photo above (connected to the incoming, brown "live" wire) is a fuse holder with a 3A quick-blow fuse fitted. We decided to keep this in place as an extra safety precaution (messing about with 240V mains can be both scary and dangerous, so always treat it with respect!)
One problem with the nail units is the use of cheap, vac-formed lamp holders, integrated into the large white housing. Grumpy Paul showed how to cut these free properly - not just going at them with a hacksaw as originally proposed, but to score around each lamp holder with a sharp blade, and them snapping them free from the surrounding material.
To make sure we were along the right tracks, we connected just two (of the three) modified devices together, using a bank of screw terminals fixed to some strip/vero board, and fired it up....
Success! All eight bulbs lit up first time. Things already look very promising! By simply repeating the whole process for the third and final nail drying unit, we got all 12 bulbs connected and running from a single 240V power supply:
Now for some quick maths: each bulb is rated at 9W (these are flourescent bulbs after all, which are much less power-hungry than traditional tungsten filament bulbs). So we have 12 x 9W = 108W (plus perhaps a few mW for the logic control on each of the boards which is insignificant in the grand scheme of things). Not much more than a single, bright, filament-based light-bulb.
Since power = current * voltage, we can re-arrange this formula to get current = power / voltage. Which means our unit is likely to draw 108/240 = 0.45 amps.
Even using the single plug from just one of the units, and a single fuse for the entire set of three controllers, we're well under the 3A rating of the quick-blow fuse (and the fuse in the mains plug). So no further modification is required - we should be just fine running our new UV exposure unit from a single socket, exactly as it it (ok, maybe we need to reposition a few of those lamps!)
Being able to switch the entire set of UV bulbs on and off from a singe power source means we can now get on with building our own PIC-controlled timer/relay unit, two switch the entire thing on and off, and allow us to set an exposure time to the nearest second. Perhaps that's for another post......
Monday, 12 May 2014
Soldering 4-pin WS2812B SMT RGB LEDs to the laser shades
Wow. That's a lot of acronyms in just one title! But here's a quick description of what we've found to be the best way to solder the 4-pin surface mount LEDs for our laser shades project.
To begin with, we're working on a homemade PCB with exposed copper tracks - none of what follows would probably be required, if the board were "professionally" made, with solder mask and so on. But we've lots of exposed copper. And that means lots of opportunities for bridging (and lots of potential points of failure!)
Here's a close-up of the board we're working on:
There's not much room between the top-left pin of one LED and the top-right of the succeeding one (we're placing our LEDs from right to left). Also, it's possible that while soldering the top-right pin of the LED, there's a chance of bridging onto the power rail running along the top of each row.
(Note that the holes drilled into the board serve no mechanical purpose - but the do allow the wearer some kind of vision while wearing the shades!)
Our preferred method of hand-soldering SMT parts is to coat the pads with flux pen and place the solder paste directly onto the pads. Except, in this case, the tiniest little movement while placing the LED could result in solder paste being smeared between the pads and the tracks above. And should this happen, there's no guarantee we'll be able to get our soldering iron in there, to burn away any excess.
Instead of placing the solder paste onto the pads, we're using a bit of wire to apply the paste onto the sides of the pads on each RGB LED.
There's no solder being applied to the underside of the LEDs (which probably means the connection is not as "true" as it might be) but when we apply heat via the iron, the solder that's been applied to the sides of the pads makes a nice, neat connection to the pad underneath.
It's a slightly peculiar way of applying paste (and may well be frowned upon by a few people) but it does make soldering rows of these in close proximity a little easier!
After applying each LED, we test for continuity between the data out of the preceding LED and the data in on the LED just placed. We also test for continuity between the Vdd pin and the power rail, and the Vss pin and the ground rail. Lastly, we test for continuity between the Vdd and Vss pins (to make sure that there is none, otherwise we've shorted something during soldering!)
After about 40 minutes, we had our first row soldered up:
We've six rows in total, but some of these are not full rows - so without counting, we reckon we're probably about a fifth of the way there!
To begin with, we're working on a homemade PCB with exposed copper tracks - none of what follows would probably be required, if the board were "professionally" made, with solder mask and so on. But we've lots of exposed copper. And that means lots of opportunities for bridging (and lots of potential points of failure!)
Here's a close-up of the board we're working on:
There's not much room between the top-left pin of one LED and the top-right of the succeeding one (we're placing our LEDs from right to left). Also, it's possible that while soldering the top-right pin of the LED, there's a chance of bridging onto the power rail running along the top of each row.
(Note that the holes drilled into the board serve no mechanical purpose - but the do allow the wearer some kind of vision while wearing the shades!)
Our preferred method of hand-soldering SMT parts is to coat the pads with flux pen and place the solder paste directly onto the pads. Except, in this case, the tiniest little movement while placing the LED could result in solder paste being smeared between the pads and the tracks above. And should this happen, there's no guarantee we'll be able to get our soldering iron in there, to burn away any excess.
Instead of placing the solder paste onto the pads, we're using a bit of wire to apply the paste onto the sides of the pads on each RGB LED.
There's no solder being applied to the underside of the LEDs (which probably means the connection is not as "true" as it might be) but when we apply heat via the iron, the solder that's been applied to the sides of the pads makes a nice, neat connection to the pad underneath.
It's a slightly peculiar way of applying paste (and may well be frowned upon by a few people) but it does make soldering rows of these in close proximity a little easier!
After applying each LED, we test for continuity between the data out of the preceding LED and the data in on the LED just placed. We also test for continuity between the Vdd pin and the power rail, and the Vss pin and the ground rail. Lastly, we test for continuity between the Vdd and Vss pins (to make sure that there is none, otherwise we've shorted something during soldering!)
After about 40 minutes, we had our first row soldered up:
We've six rows in total, but some of these are not full rows - so without counting, we reckon we're probably about a fifth of the way there!
Saturday, 3 May 2014
Laser shades - LED 3d glasses - data format
We've got a few LEDs soldered onto a board now, for testing our crazy LED shades so we need to be able to send data to them to get them LEDs to light up. Which means thinking about some kind of data format.
Originally the idea was to have a "video screen" made up of single-coloured LEDs, but using these fully-addressable RGB WS2812 jobbies, we're concentrating more on patterns and simple shapes, rather than actual images or text. So the plan is to have an editor where the user can create individual "frames" for a pattern, which will be stored in an eeprom chip (maybe something simple like a 24C256 serial eeprom). Then an animation pattern can be played by simply saying "display frame x, scroll left for y frames, with a delay of z milliseconds between each".
Our fully addressable RGB LEDs have multiple levels of reg, green and blue, thanks to a 3-byte interface (each colour has intensities 0-7, allowing the full range of RGB colours from 0x00 to 0xFF to be displayed). But in truth, there's not really much difference, on the LED output between RGB(255,0,0) and RGB(250,0,0). Similarly, the purple produced using RGB (255,0,255) looks very similar to the one produced by RGB(240,0,240) and similar subtle differences in intensity of red and blue.
Since each "frame" is a 6x5 grid (30 pixels) and each pixel is 3 bytes, to store the RGB values for a single full colour frame requires 90 bytes. For both lenses, that'll be 180 bytes. For a single frame. Our 24C256 eeprom has 32,768 bytes of memory. That sounds a lot, but it works out at just 182 individual frames (32768 / 180 = 182.04). This may be enough, but it'd be nice to have the extra capacity for "stop frame" animation, should the need arise.
So we've decided that instead of a full 24-bit colour interface, giving a palette of 16 million colours, we're going to use the GIF image format idea, and use a palette for each image that makes up a frame - simply reduce each colour to 2R, 2G, 2B and use the numbers 0-63 to refer to each individual colour.
Sure, we won't get 255 different shades of purple, for example, but we'll have about four. And four different shades of purple is more than enough, for drawing patterns on our glasses lenses! This allows us to store the colour of each pixel in the image in a single byte; meaning one frame of animation requires only 30 bytes per lens. And our eeprom can store over a thousand individual frames of animation (546 per lens).
When converting our stored image to a 24-bit value for the LEDs, we'll simply read the first 6 bits of the value from eeprom and break each value into 3 lots of 2-bit values (each part having the value 0-3).
On a value zero (b00) we send, obviously, zero.
On a value one (b01) we send 255/3 = 85 (or 0x55 in hex)
On a value two (b10) we send 2*(255/3) = 170 (0xAA in hex)
On a value three (b11) we send 255 (or 0xFF in hex).
So we'll simply store each frame of our animations as a stream of 30 bytes (each pixel being a palette colour reference) in eeprom, jump to the correct address where the image information begins, and read back 30 bytes. We could even program the microcontroller to perform simple animations with each single frame, instead of having to keep reloading the information.
For example, we might load an image into memory, and draw it from the top-right corner, to the bottom left, using the sequence below:
If we wanted to scroll the frame upwards, for example, we don't need to go back to the eeprom to load a second frame of animation - we simply do some array value swapping as shown on the spreadsheet under "shift up": so array(1) takes the value in array(7), array(7) takes the value in array(13), array(13) takes the value that was in array(19) and so on. Once all the values have been shifted around in the array, the 30 colours (90 bytes) of data are shifted into the LED matrix, to get the new, scrolled image to appear.
Of course, all this is fine in theory. What we need to do is finish soldering up at least one lens, to allow us to actually test it all out!
Originally the idea was to have a "video screen" made up of single-coloured LEDs, but using these fully-addressable RGB WS2812 jobbies, we're concentrating more on patterns and simple shapes, rather than actual images or text. So the plan is to have an editor where the user can create individual "frames" for a pattern, which will be stored in an eeprom chip (maybe something simple like a 24C256 serial eeprom). Then an animation pattern can be played by simply saying "display frame x, scroll left for y frames, with a delay of z milliseconds between each".
Our fully addressable RGB LEDs have multiple levels of reg, green and blue, thanks to a 3-byte interface (each colour has intensities 0-7, allowing the full range of RGB colours from 0x00 to 0xFF to be displayed). But in truth, there's not really much difference, on the LED output between RGB(255,0,0) and RGB(250,0,0). Similarly, the purple produced using RGB (255,0,255) looks very similar to the one produced by RGB(240,0,240) and similar subtle differences in intensity of red and blue.
Since each "frame" is a 6x5 grid (30 pixels) and each pixel is 3 bytes, to store the RGB values for a single full colour frame requires 90 bytes. For both lenses, that'll be 180 bytes. For a single frame. Our 24C256 eeprom has 32,768 bytes of memory. That sounds a lot, but it works out at just 182 individual frames (32768 / 180 = 182.04). This may be enough, but it'd be nice to have the extra capacity for "stop frame" animation, should the need arise.
So we've decided that instead of a full 24-bit colour interface, giving a palette of 16 million colours, we're going to use the GIF image format idea, and use a palette for each image that makes up a frame - simply reduce each colour to 2R, 2G, 2B and use the numbers 0-63 to refer to each individual colour.
Sure, we won't get 255 different shades of purple, for example, but we'll have about four. And four different shades of purple is more than enough, for drawing patterns on our glasses lenses! This allows us to store the colour of each pixel in the image in a single byte; meaning one frame of animation requires only 30 bytes per lens. And our eeprom can store over a thousand individual frames of animation (546 per lens).
When converting our stored image to a 24-bit value for the LEDs, we'll simply read the first 6 bits of the value from eeprom and break each value into 3 lots of 2-bit values (each part having the value 0-3).
On a value zero (b00) we send, obviously, zero.
On a value one (b01) we send 255/3 = 85 (or 0x55 in hex)
On a value two (b10) we send 2*(255/3) = 170 (0xAA in hex)
On a value three (b11) we send 255 (or 0xFF in hex).
In truth, when reducing colours to a low-bit pattern, red and blue tend to take precedence over green. So reducing a 24 bit 8R-8G-8B colour to 16 bit is usually done by reducing to 5R 6G 5B. Green gets the extra bit, as the human eye can detect a wider range of shades in the green spectrum, apparently (http://en.wikipedia.org/wiki/High_color). We've also found, with some RGB LEDs, that the red component can sometimes be a little overpowering (though on some, it's the blue element). So when we come to actually implement our bit-depth reduction, we can "weight" two of the three component colours, should any one be more prominent that the others. In practice, we may actually end up with 2R 3G 3B for example.
So we'll simply store each frame of our animations as a stream of 30 bytes (each pixel being a palette colour reference) in eeprom, jump to the correct address where the image information begins, and read back 30 bytes. We could even program the microcontroller to perform simple animations with each single frame, instead of having to keep reloading the information.
For example, we might load an image into memory, and draw it from the top-right corner, to the bottom left, using the sequence below:
We draw our images from top-left to bottom right, simply because of the LED pixel layout - the data in pins are on the bottom right of the LED, so it makes sense to push the data into the first pixel from the right, shunting it along to the next LED (to the left).
If we wanted to scroll the frame upwards, for example, we don't need to go back to the eeprom to load a second frame of animation - we simply do some array value swapping as shown on the spreadsheet under "shift up": so array(1) takes the value in array(7), array(7) takes the value in array(13), array(13) takes the value that was in array(19) and so on. Once all the values have been shifted around in the array, the 30 colours (90 bytes) of data are shifted into the LED matrix, to get the new, scrolled image to appear.
Of course, all this is fine in theory. What we need to do is finish soldering up at least one lens, to allow us to actually test it all out!
Friday, 2 May 2014
Testing homebrew solder resist with enamel paint
UV curable solder mask is great stuff. But when you misplace your tub of it, and a replacement coming from China is going to take anywhere between 15 and 30 days, and you've a project which - for once - actually really needs solder resist to be reliable, it's time to get creative.
Our laser-shades project (ok, it doesn't use lasers, more LEDs, and they're not really shades, more like blanked out 3d glasses) has some really fine 0.25mm traces, squeezed between the pads of a WS2812 6-pin LED. Now we've had experience of working with fine pitched, laser-etched PCBs in the past, and it wasn't pretty. It's one thing to successfully etch a PCB with fine traces - and quite another to successfully solder it up!
So this time, we figured, before we made a mess of the project with our soldering irons, it'd be worthwhile making a solder mask. We've also had some success in the past, using nail varnish as a solder resist (however clumsily applied). This time, rather than using nail varnish, we thought we'd give Humbrol enamel paint a try. Not only does it usually give a nice, solid coat (the nail varnish looks a little translucent at best) but the local hobby store sells a massive range of colours. We went for the most lurid, garish ones he sold (the orange and dark green are actually fluorescent, which doesn't come out too well in the photo below)
The idea is to apply some peelable solder mask (Chemask from Farnell) over the pads, then paint the entire board in enamel paint. Then the peelable mask can be pulled away from the pads, leaving the shiny copper behind, while the rest of the board will be coated in enamel paint (a cheap solder resist).
To apply the dots of mask on each of the pads required a stencil. We used some plastic-laminated thick paper and laser cut the pads, once each had been resized to about 75% (to allow for a bit of "spread" during laser cutting, and to make sure that the mask didn't extend beyond the outline of each pad).
Lining up the stencil with the actual pads was a bit tricky at first, but after applying some double-sided tape to the back, and some careful re-alignment, we finally got a half-decent match
Aside from a bit of smearing as the stencil was lifted off, the result was pretty good. As it wasn't critical that the pads affected on the right-hand side of the board were well masked (it's mostly the bottom-left and middle-left pads that really needed the solder resist to avoid bridging during soldering) we decided this was good enough!
Then we hit our first disappointment (and, dear reader, so might you, as we forgot to take photos of the disaster!). The enamel paint remains sticky for a very long time, taking 6 hours or more to dry fully. It is also quite tacky during application. The very real danger with this method - which we only just realised - was that as the enamel paint is applied, is starts to lift the latex-based mask on the pads, and seeps underneath. Not good!
So Steve did some tests with acrylic car paint. Unconvinced that it would be heat resistant, he tried soldering a couple of spots on some painted copper board. Surprisingly, the acrylic held firm and acted as a solder mask on the un-exposed areas.
When we tested nail varnish as solder resist, we deliberately tried to burn the varnish away with the iron, to see how it holds up under extreme heat. When soldering using paste and SMT components, we tend to apply the iron only for as long is necessary - so the acrylic paint doesn't need to be as robust as enamel-based paint, just good enough to withstand hot solder paste (not the iron directly) for a short period of time.
Inspired by this, we re-applied the latex mask and sprayed the board with Halfords acrylic car paint. Then we a second, and similar, disaster
As the latex mask was lifted off the pads, it ripped the acrylic paint off in chunks, exposing the copper traces we were so keen to keep covered over. A new approach was needed - it was nearing midnight (so the deadline for success was looming over us!). The simplest - and most obvious - method worked quite well:
The entire board was sprayed with acrylic car paint, and under a bright light (it really hurts your eyes to do this under ambient light) the raised copper pads were scraped clear using the tip of a large drawing pin. While the final result is not particularly neat, it does look serviceable:
That was it for another BuildBrighton session. We've now got one PCB we can have a got at soldering up. And a number of methods not to use for making homebrew solder-resist on the cheap!
Subscribe to:
Posts (Atom)





































