While there's not been much activity on the blog for the last few weeks, things have been pretty busy elsewhere. Firstly, we're looking at the feasibility of manufacturing locally and getting more people and businesses involved; so rather than sending designs away to the other side of the world to be made up, we're trying to encourage more people "back home" to try manufacturing themselves. Which has kept us busy these last few weeks - and hopefully we'll have more to report very soon.
In the meantime, locally-sourced manufacturing came one step closer to makers in Brighton with a new CNC router being installed at everyone's favourite local hackspace, BuildBrighton
Here it is, up and running - routing shapes out of scrap MDF today, but who knows.... PCBs next week?
Friday, 31 May 2013
Friday, 17 May 2013
Messing about with 7 segment displays and a PIC 16F628a
I scored a load of cheap 4-way 7-segment displays off eBay the other day. They worked out at about 30p each so I got 20 and stuffed them in a drawer. Then I thought that perhaps it'd be nice to get one working, just so that we know what to do with them in future projects (one already springs to mind).
So here's a simple 4-way 7-segment LCD display hooked up to a PIC 16F628a microcontroller. We're running the PIC off it's own internal oscillator (there's nothing time critical going on here) and will use a simple direct drive method to make them light up.
Basically this means we'll light one digit it a time - lighting the appropriate segments of each character in a 4-digit number and waiting a few milliseconds before moving on to the next. Persistence of vision will give the illusion that all characters are illuminated at the same time.
These particular 7-segment displays have a common anode - each digit shares the same "power" supply and we need to pull different pins to ground to get the different segments to light up. The display also includes decimal point characters and a double-dot (colon) character for use with digital clocks and so on.
While you can use a driver chip (like a MAX7219) or even a shift register or two to display the digits on these, it's easy enough to drive them directly from the i/o pins. Eight segments and 4 characters means 12 pins are needed to display all four characters at a time.
As ever, we're using Oshonsoft PIC Simulator to write the code in BASIC and using the keyword SYMBOL to assign a descriptive word to an i/o pin. This is really handy because when it comes to laying out your circuits on a PCB, sometimes you need to flip pins around to simplify the layout. Instead of going through all your code and changing every reference to PORTB.0, for example, you simply change which pin the symbol points to.
Here's the code. It's just a counter, but demonstrates how to display all 4 digits at the same time:
And here's a video showing the counter in action:
Basically this means we'll light one digit it a time - lighting the appropriate segments of each character in a 4-digit number and waiting a few milliseconds before moving on to the next. Persistence of vision will give the illusion that all characters are illuminated at the same time.
These particular 7-segment displays have a common anode - each digit shares the same "power" supply and we need to pull different pins to ground to get the different segments to light up. The display also includes decimal point characters and a double-dot (colon) character for use with digital clocks and so on.
While you can use a driver chip (like a MAX7219) or even a shift register or two to display the digits on these, it's easy enough to drive them directly from the i/o pins. Eight segments and 4 characters means 12 pins are needed to display all four characters at a time.
As ever, we're using Oshonsoft PIC Simulator to write the code in BASIC and using the keyword SYMBOL to assign a descriptive word to an i/o pin. This is really handy because when it comes to laying out your circuits on a PCB, sometimes you need to flip pins around to simplify the layout. Instead of going through all your code and changing every reference to PORTB.0, for example, you simply change which pin the symbol points to.
Here's the code. It's just a counter, but demonstrates how to display all 4 digits at the same time:
Define CONF_WORD = 0x3f18
Define CLOCK_FREQUENCY = 4
AllDigital
Config PORTA = Output
Config PORTB = Output
Dim i(4) As Byte
Dim tmp As Byte
Dim j As Byte
Dim k As Byte
Symbol pin_a = PORTB.3
Symbol pin_b = PORTB.0
Symbol pin_c = PORTB.7
Symbol pin_d = PORTB.5
Symbol pin_e = PORTB.4
Symbol pin_f = PORTB.6
Symbol pin_g = PORTB.1
init:
'rather than a single variable counting 0-9999
'we'll keep track of the tens, hundreds, thousands
'and units separately to make displaying them easier
i(0) = 0
i(1) = 0
i(2) = 0
i(3) = 0
loop:
For k = 1 To 100
'activate all four characters, one after the other,
'but really quickly in succession
For j = 0 To 3
tmp = i(j)
'turn off all characters
PORTA = 0x00
PORTB = 0xff
'pull the appropriate segments in each character
'low in order to light them up
Select Case tmp
Case 0
'a,b,c,d,e,f=low g=high
Low pin_a
Low pin_b
Low pin_c
Low pin_d
Low pin_e
Low pin_f
High pin_g
Case 1
'b,c=low
High pin_a
Low pin_b
Low pin_c
High pin_d
High pin_e
High pin_f
High pin_g
Case 2
'a,b,d,e,g=low
Low pin_a
Low pin_b
High pin_c
Low pin_d
Low pin_e
High pin_f
Low pin_g
Case 3
'a,b,c,d,g=low
Low pin_a
Low pin_b
Low pin_c
Low pin_d
High pin_e
High pin_f
Low pin_g
Case 4
'b,c,f,g=low
High pin_a
Low pin_b
Low pin_c
High pin_d
High pin_e
Low pin_f
Low pin_g
Case 5
'a,c,d,f,g=low
Low pin_a
High pin_b
Low pin_c
Low pin_d
High pin_e
Low pin_f
Low pin_g
Case 6
'a,c,d,e,f,g=low
Low pin_a
High pin_b
Low pin_c
Low pin_d
Low pin_e
Low pin_f
Low pin_g
Case 7
'a,b,c=low
Low pin_a
Low pin_b
Low pin_c
High pin_d
High pin_e
High pin_f
High pin_g
Case 8
'a,b,c,d,e,f,g=low
Low pin_a
Low pin_b
Low pin_c
Low pin_d
Low pin_e
Low pin_f
Low pin_g
Case 9
'a,b,c,d,f,g=low
Low pin_a
Low pin_b
Low pin_c
Low pin_d
High pin_e
Low pin_f
Low pin_g
Case Else
High pin_a
High pin_b
High pin_c
High pin_d
High pin_e
High pin_f
Low pin_g
EndSelect
'activate the appropriate digit
'by giving it power
Select Case j
Case 0
High PORTA.1
Case 1
High PORTA.2
Case 2
High PORTA.6
Case 3
High PORTA.3
EndSelect
'wait a little while for the LED to appear lit
'(thanks to persistence of vision it will appear lit
'all the time when actually it's really flickering)
WaitMs 2
Next j
Next k
'increase the units variable
i(0) = i(0) + 1
'if we've rolled over to 10, increase the tens
'by one and set units back to zero
If i(0) >= 10 Then
i(0) = 0
i(1) = i(1) + 1
Endif
'if we've rolled over to 100, increase the
'hundreds by one and set tens back to zero
If i(1) >= 10 Then
i(1) = 0
i(2) = i(2) + 1
Endif
'if we've rolled over to 1000, increase the
'thousands by one and set the hundreds back to zero
If i(2) >= 10 Then
i(2) = 0
i(3) = i(3) + 1
Endif
Goto loop
End
Define CLOCK_FREQUENCY = 4
AllDigital
Config PORTA = Output
Config PORTB = Output
Dim i(4) As Byte
Dim tmp As Byte
Dim j As Byte
Dim k As Byte
Symbol pin_a = PORTB.3
Symbol pin_b = PORTB.0
Symbol pin_c = PORTB.7
Symbol pin_d = PORTB.5
Symbol pin_e = PORTB.4
Symbol pin_f = PORTB.6
Symbol pin_g = PORTB.1
init:
'rather than a single variable counting 0-9999
'we'll keep track of the tens, hundreds, thousands
'and units separately to make displaying them easier
i(0) = 0
i(1) = 0
i(2) = 0
i(3) = 0
loop:
For k = 1 To 100
'activate all four characters, one after the other,
'but really quickly in succession
For j = 0 To 3
tmp = i(j)
'turn off all characters
PORTA = 0x00
PORTB = 0xff
'pull the appropriate segments in each character
'low in order to light them up
Select Case tmp
Case 0
'a,b,c,d,e,f=low g=high
Low pin_a
Low pin_b
Low pin_c
Low pin_d
Low pin_e
Low pin_f
High pin_g
Case 1
'b,c=low
High pin_a
Low pin_b
Low pin_c
High pin_d
High pin_e
High pin_f
High pin_g
Case 2
'a,b,d,e,g=low
Low pin_a
Low pin_b
High pin_c
Low pin_d
Low pin_e
High pin_f
Low pin_g
Case 3
'a,b,c,d,g=low
Low pin_a
Low pin_b
Low pin_c
Low pin_d
High pin_e
High pin_f
Low pin_g
Case 4
'b,c,f,g=low
High pin_a
Low pin_b
Low pin_c
High pin_d
High pin_e
Low pin_f
Low pin_g
Case 5
'a,c,d,f,g=low
Low pin_a
High pin_b
Low pin_c
Low pin_d
High pin_e
Low pin_f
Low pin_g
Case 6
'a,c,d,e,f,g=low
Low pin_a
High pin_b
Low pin_c
Low pin_d
Low pin_e
Low pin_f
Low pin_g
Case 7
'a,b,c=low
Low pin_a
Low pin_b
Low pin_c
High pin_d
High pin_e
High pin_f
High pin_g
Case 8
'a,b,c,d,e,f,g=low
Low pin_a
Low pin_b
Low pin_c
Low pin_d
Low pin_e
Low pin_f
Low pin_g
Case 9
'a,b,c,d,f,g=low
Low pin_a
Low pin_b
Low pin_c
Low pin_d
High pin_e
Low pin_f
Low pin_g
Case Else
High pin_a
High pin_b
High pin_c
High pin_d
High pin_e
High pin_f
Low pin_g
EndSelect
'activate the appropriate digit
'by giving it power
Select Case j
Case 0
High PORTA.1
Case 1
High PORTA.2
Case 2
High PORTA.6
Case 3
High PORTA.3
EndSelect
'wait a little while for the LED to appear lit
'(thanks to persistence of vision it will appear lit
'all the time when actually it's really flickering)
WaitMs 2
Next j
Next k
'increase the units variable
i(0) = i(0) + 1
'if we've rolled over to 10, increase the tens
'by one and set units back to zero
If i(0) >= 10 Then
i(0) = 0
i(1) = i(1) + 1
Endif
'if we've rolled over to 100, increase the
'hundreds by one and set tens back to zero
If i(1) >= 10 Then
i(1) = 0
i(2) = i(2) + 1
Endif
'if we've rolled over to 1000, increase the
'thousands by one and set the hundreds back to zero
If i(2) >= 10 Then
i(2) = 0
i(3) = i(3) + 1
Endif
Goto loop
End
And here's a video showing the counter in action:
Wednesday, 15 May 2013
More crazy Farnell packaging
We love Farnell here at Nerd Towers - pop onto their website click around a bit and the next morning, a parcel arrives with all your lovely goodies. Sometimes you can leave it as late at 7pm and your stuff still arrives the next day! But sometimes their choice of packaging leaves a bit to be desired.
Here's what arrived this morning, and the carton it arrived in:
The speakers came in their own dedicated and padded boxes too. Surely a padded envelope would have sufficed?
Here's what arrived this morning, and the carton it arrived in:
The speakers came in their own dedicated and padded boxes too. Surely a padded envelope would have sufficed?
Tuesday, 14 May 2013
Artwork for screen printing PCBs
Since we got back from Berlin (after a two-day drive on each leg of the journey, and a total of 1,500 miles there and back) we've been giving lots of thought to silkscreen printing for making lots of PCBs.
We've gone back-and-forth with numerous designs, going from A4 panels (so front and back would fit on a single A3 frame) to 160x140 panels (double-sided 200x200mm copper clad board is easier to source than A4 sheets) to eurocard and back to A4.
After about six iterations of the same board design - each time reducing the number of jumpers and vias on our double-sided board, we still couldn't get a design which used as much of the copper board as possible: no matter what the layout, there was always quite a bit of waste on each panel. And then we had an epiphany moment....
We've been concentrating on making a hex-based board for the Dreadball Board Game. And because the miniatures stand on 25mm clear bases, we've been concentrating on making each "cell" on the board at least 30mm - allowing for a 2mm border around each cell, this allows a 28mm push-button surface (miniatures for other games are sometimes provided on 28mm round slotta-style bases). And it's because of these relatively large cells we can't get them to fit nicely on any "standard" sized copper clad board. But here's a thought....
The miniatures in Dreadball are much smaller than standard (read Games Workshop) miniatures. Originally they were designed to be used as-is from out of the box, but a lot of players complained that they fall over easily (because the bases are so ridiculously small)
So Mantic included some clear acrylic bases for the miniatures to stand up in. But the bases provided are pretty lame too - the recess for the rounded player base is too large and the miniature doesn't clip in nicely - it needs to be glued into place. Interestingly, all of the pre-release artwork for the game shows the miniatures painted up minus the clear acrylic bases, which suggests they were just added in as an after-thought.
So already we're thinking of cutting some fresh clear acrylic bases for the miniatures, to make the playing pieces clip in nicely instead of flopping about or needing to be held in with glue.
And then we got to thinking - if we're going to laser-cut our own bases from 3mm sheet acrylic anyway, why not make them a bit smaller and just reduce the size of each cell in our game board?
And that's exactly what we did.
This time, we're using cell dimensions of 20mm. Allowing for a 1mm border all around (a 2mm gutter between each space on the board) means each hexagon needs to be at least 22mm high.
And by some bizarre coincidence, when we placed a pattern of 8 hexes across and 4 hexes down, reduced to 22mm instead of 30mm, the total PCB layout fits exactly into a 160mm x 100mm rectangle!
This gives us four "blocks" of 8 hexes per module. Which is a nice number for handling with software/firmware - certainly much easier to deal with than 3 columns of 8 which is what we had on our latest design. And the amount of waste around the outside of the module is kept to an absolute minimum. So all in all, we're quite happy with this latest design.
Making a 3x3 grid of these modules gives us a board of 24 hexes across and 12 hexes down - a few over from the 11x23 that make up the widest points of a Dreadball pitch, but sufficient to make a playable surface. Double-sided eurocard-sized copper board is all over the internet, so this design is perfect in terms of ease of manufacture as well as for sourcing the materials. The final board made up from these modules is a decent size too:
Eighteen inches isn't a massive board, but is still a pretty decent size. And when the board is all made up with etched squares and flashing LEDs, the closer proximity of the miniature playing pieces will make for a slightly more chaotic-looking game - just like a real futuristic sports simulation!
We're planning on getting a silkscreen made up with the top design on top and a mirrored copy of the bottom design on the bottom of an A4 sized frame. This will allow us to use the same screen for both sides of the board - we just need to mask off the unused bit and make sure the board is correctly lined up before each print, but that's not a major issue... is it?
We've gone back-and-forth with numerous designs, going from A4 panels (so front and back would fit on a single A3 frame) to 160x140 panels (double-sided 200x200mm copper clad board is easier to source than A4 sheets) to eurocard and back to A4.
After about six iterations of the same board design - each time reducing the number of jumpers and vias on our double-sided board, we still couldn't get a design which used as much of the copper board as possible: no matter what the layout, there was always quite a bit of waste on each panel. And then we had an epiphany moment....
We've been concentrating on making a hex-based board for the Dreadball Board Game. And because the miniatures stand on 25mm clear bases, we've been concentrating on making each "cell" on the board at least 30mm - allowing for a 2mm border around each cell, this allows a 28mm push-button surface (miniatures for other games are sometimes provided on 28mm round slotta-style bases). And it's because of these relatively large cells we can't get them to fit nicely on any "standard" sized copper clad board. But here's a thought....
The miniatures in Dreadball are much smaller than standard (read Games Workshop) miniatures. Originally they were designed to be used as-is from out of the box, but a lot of players complained that they fall over easily (because the bases are so ridiculously small)
So Mantic included some clear acrylic bases for the miniatures to stand up in. But the bases provided are pretty lame too - the recess for the rounded player base is too large and the miniature doesn't clip in nicely - it needs to be glued into place. Interestingly, all of the pre-release artwork for the game shows the miniatures painted up minus the clear acrylic bases, which suggests they were just added in as an after-thought.
So already we're thinking of cutting some fresh clear acrylic bases for the miniatures, to make the playing pieces clip in nicely instead of flopping about or needing to be held in with glue.
And then we got to thinking - if we're going to laser-cut our own bases from 3mm sheet acrylic anyway, why not make them a bit smaller and just reduce the size of each cell in our game board?
And that's exactly what we did.
This time, we're using cell dimensions of 20mm. Allowing for a 1mm border all around (a 2mm gutter between each space on the board) means each hexagon needs to be at least 22mm high.
And by some bizarre coincidence, when we placed a pattern of 8 hexes across and 4 hexes down, reduced to 22mm instead of 30mm, the total PCB layout fits exactly into a 160mm x 100mm rectangle!
This gives us four "blocks" of 8 hexes per module. Which is a nice number for handling with software/firmware - certainly much easier to deal with than 3 columns of 8 which is what we had on our latest design. And the amount of waste around the outside of the module is kept to an absolute minimum. So all in all, we're quite happy with this latest design.
Making a 3x3 grid of these modules gives us a board of 24 hexes across and 12 hexes down - a few over from the 11x23 that make up the widest points of a Dreadball pitch, but sufficient to make a playable surface. Double-sided eurocard-sized copper board is all over the internet, so this design is perfect in terms of ease of manufacture as well as for sourcing the materials. The final board made up from these modules is a decent size too:
Eighteen inches isn't a massive board, but is still a pretty decent size. And when the board is all made up with etched squares and flashing LEDs, the closer proximity of the miniature playing pieces will make for a slightly more chaotic-looking game - just like a real futuristic sports simulation!
We're planning on getting a silkscreen made up with the top design on top and a mirrored copy of the bottom design on the bottom of an A4 sized frame. This will allow us to use the same screen for both sides of the board - we just need to mask off the unused bit and make sure the board is correctly lined up before each print, but that's not a major issue... is it?
Wednesday, 8 May 2013
Screen printing PCBs
It's official - making a homebrew screen from a bit of left-over silk, stapled to a picture frame and masked with pound-shop parcel tape, not only works, but works really well! On our frame we had a stencil of the pcb tracks, and a stencil for the solder mask. We started by covering one half of the screen with parcel tape...
... then swiped some acrylic paint over the other half of the screen:
In seconds we had a dozen or more perfectly printed PCBs (on test paper admittedly, not copper board, but it proved the concept)
Knowing we could now rattle out PCBs quickly and easily, the next thing to do was make sure the second print lined up with the first. Here we used red acrylic instead of the expensive solder mask paint:
They actually lined up pretty good. Not perfect (but then the screen wasn't fully taught and the board was lined up by eye) but not bad at all. It'd make a perfectly workable PCB!
All in all, we're calling our screen-printing test a success.
We got a screen made and using acrylic paint, quickly and easily printed a number of circuit boards in seconds. When it comes to making batches of PCBs with the same design, this is definitely something we want to use, in place of sending designs off to China!
... then swiped some acrylic paint over the other half of the screen:
In seconds we had a dozen or more perfectly printed PCBs (on test paper admittedly, not copper board, but it proved the concept)
Knowing we could now rattle out PCBs quickly and easily, the next thing to do was make sure the second print lined up with the first. Here we used red acrylic instead of the expensive solder mask paint:
They actually lined up pretty good. Not perfect (but then the screen wasn't fully taught and the board was lined up by eye) but not bad at all. It'd make a perfectly workable PCB!
All in all, we're calling our screen-printing test a success.
We got a screen made and using acrylic paint, quickly and easily printed a number of circuit boards in seconds. When it comes to making batches of PCBs with the same design, this is definitely something we want to use, in place of sending designs off to China!
Tuesday, 7 May 2013
Nerds in Berlin (again)
We've been here in Berlin for a few days - in the salubrious district of Kreuzberg - and slowly getting to understand (some) of the appeal. It has many similarities to Brighton: only a grubby, dirtier, graffiti-strewn version - and no seaside. The last time I came, I hated it. This time, the weather is better, there are more people about, and we've met some really cool characters. Kreuzberg is still a dirty, rotten area of Berlin, but - as with so many places - it's the people that make the city, and we've met some pretty cool ones!
One of the more exciting things about our short visit was visiting the drop-in print making workshop. There are places like this all over Berlin: places that hackerspaces should be aspiring to. It's basically a shop where you turn up, explain what you need to do and they supply the parts, materials, equipment and (where it's needed) expertise to help you get the job done.
The shop is open an manned by staff five days a week; there's a massive indie/punk subculture in Berlin where people make their own t-shirts, fliers and cd/album covers, mostly using screen printing. Everyone seems to know someone who knows screen-printing! So we took ourselves along to see how it all works.
Andrea made up a simple screen by hand-stretching some medium-grade silk over an A4 sized picture frame and stapled it along each edge. Although you can get machine-stretched frames, this hand-made one seemed pretty taught, so we thought we'd just give it a go. At the print-shop they provided the photo-sensitive emulsion. It's ready mixed, so you just need to put a thin film on your screen and leave it to dry.
One of the more exciting things about our short visit was visiting the drop-in print making workshop. There are places like this all over Berlin: places that hackerspaces should be aspiring to. It's basically a shop where you turn up, explain what you need to do and they supply the parts, materials, equipment and (where it's needed) expertise to help you get the job done.
The shop is open an manned by staff five days a week; there's a massive indie/punk subculture in Berlin where people make their own t-shirts, fliers and cd/album covers, mostly using screen printing. Everyone seems to know someone who knows screen-printing! So we took ourselves along to see how it all works.
Andrea made up a simple screen by hand-stretching some medium-grade silk over an A4 sized picture frame and stapled it along each edge. Although you can get machine-stretched frames, this hand-made one seemed pretty taught, so we thought we'd just give it a go. At the print-shop they provided the photo-sensitive emulsion. It's ready mixed, so you just need to put a thin film on your screen and leave it to dry.
the photo-emulsion is a bright lime-green colour. When it's "baked" it goes a dark, leafy-green colour.
A thin film of paint is dropped into a trough (it's expensive stuff and is difficult to re-use, so only the smallest amount needed is taken out of the pot) and the trough is swiped quickly up both sides of the silk - working vertically, from bottom to top
The aim is not to place a film on the surface of the screen (although this may happen) - it should be as thin as possible and we're just trying to get the emulsion to fill the gaps in the silk. Sometimes the paint doesn't get quite into the corners, which is why the screen needs to be oversized: our frame is for an A4 picture so is actually a little larger than A4, all the way around
While the screen was drying, in a dark, warm room, we set about preparing the artwork. Some PCB circuits were laser-printed onto 100gsm paper (not acetate as we were expecting). The paper was then coated with cooking oil (rapeseed I think) and it magically turned translucent: a handy tip to remember for future screen printing - much cheaper than expensive acetate sheets!
we weren't sure, so coated both sides of our sheet with oil
About half an hour later (or however long it takes to drink a coffee in the sunshine, at the cafe opposite) and the screen was ready for exposing. We placed the image onto the exposure bed, then the screen on top and turned on the vacuum to help remove any air bubbles trapped between the image, screen and glass bed. It took a good ten minutes - but only because the exposure box was absolutely massive!
Matt at BuildBrighton always wanted to make a large exposure bed - but this one may be outside even what he was dreaming of!
A4 on medium-guage silk takes about ten minutes to expose, apparently. So after ten minutes, we took the screen out and blasted it with a high-pressure hose. The screen wasn't as dark as we'd expected (but apparently the emulsion continues reacting in sunlight, so is yet to get a bit darker) but after a minute or so of washing, the magic started to happen. All the "unbaked" emulsion washed away and we were left with a perfect copy of our PCB design on the silk:
(our pcb design was only eurocard sized, so we put a solder mask on the bottom half of the screen)
All in all, an amazing success.
The whole thing cost less than five euros and we got help and learned a lot about the how and why of screen printing. Why the screens need to be larger than the image, why different meshes are needed for printing onto different surfaces and so on.
It was a really interesting few hours and has given us a lot of confidence with our own homebrew screen printing rig. Of course, you can use professionally manufactured screens (there were some machine-stretched screens at the workshop which were tighter than a snare drum skin!) and spend a lot of money getting everything "just so". But you can also fudge it with some cobbled-together gear and a bit of know-how. And that's what got us excited.
All we need to do now is go back and see if we can actually print an image with the screen!