Sometimes is great to get away from the computer and the soldering iron for a while and do something "old school". A while back a few of us here at Nerd Towers took up painting models again, to see if we could still do it (after 20 years, the eyesight isn't quite so keen, but the results were ok-ish) some have gone back to really old-tech stuff and even trying reading books!
If there's one book everyone should have on their bookshelves at home - and yes, Kindle-loving-cool-kids, one of those things made of paper with pages that you actually turn over and not just flip with one finger on the screen - it's the Machinery's Handbook.
This one was actually printed in 1982 but it was first published in about 1914. It's an awesome read! Lots of it is just tables - logarithmic tables, sine, cosine and tangent look-up tables and the like - but it's full of loads of really useful, and interesting, bits of information.
If you want to know how to lay out 11 holes in a circular formation, the answer's right here. Or want to know the ratio between two tangents to a circle, or a tangent and a line bisecting the radius... loads of really cool tips and short-cuts are not only useful to have under your belt when making stuff, but lots of it is just quite interesting; even if you never use most of it yourself, it's just a really good read!
Anyone interesting in getting hold of one of these classic books can just search Google or Amazon for Machinery's Handbook but get ready to shell out about �30-�40, even for a second-hand copy. But if you can afford it, it'll repay that many times over, just keeping you entertained during those enforced hours of "downtime".
Thursday, February 28, 2013
Knowing when it's time to start again
As we learned with our LC oscillator "diversion", sometimes it's ok to try something out and it simply doesn't work. Along the way, you can try ideas out, test your understanding and - sometimes - a negative outcome is just as valid as a successful one. And if something doesn't work as expected, it's fine to just say "ok, let's try something else".
But sometimes, things go wrong because you've been an idiot. The only thing we learned from this latest effort is that ordering components without fully understanding their format/package is a bad idea - here are some SOT559 hall effect sensors:
Even for SMT fans like us, there are limits to how small you can go!
But sometimes, things go wrong because you've been an idiot. The only thing we learned from this latest effort is that ordering components without fully understanding their format/package is a bad idea - here are some SOT559 hall effect sensors:
Even for SMT fans like us, there are limits to how small you can go!
Take a little time to re-route a PCB....
... even if you've already spent hours on it and just want to get your project "out of the door". We did just this, moving a couple of traces, and got a much better board because of it. We were also able to eliminate one of those nasty "jumpers" (we're using 0-ohm resistors instead of bits of wire, but they're all pretty much the same thing at the end of the day).
Tuesday, February 26, 2013
Hexbug Nano V2 habitat sets!
Yesterday's post was all about the new Hexbug Nano V2's, and we also wrote a few speculations for the new habitat sets. Today, however, we have actual photos of what the sets may look like. Based on other sets, I'm guessing that this one may rest on a price of $30. Thanks for reading and follow us to stay updates!
Introducing the all new Hexbug Nano V2
If you an avid fan for the Hexbug robots, then you probably already know that the Hexbug Nano's were sold the most. Aside from that, Innovation First has revealed (not 100% confirmed) a new type of Hexbug Nano. Unlike its predecessor, the all new Nano V2 will be able to climb vertical slopes. Yes, that's right, vertical slopes. Using multiple "arms" on its back, this Hexbug will be able to climb in and out of vertical tubes. This feature also points to the fact that new "Habitat" sets will be released later on. These sets will include intricate tubes and pathways that the Nano V2 can explore. Although a release date hasn't been confirmed, we'll probably start seeing these in the fall, perhaps the summer. I will also try to get more information such as prices and official release dates. As of now, you can expect these critters to cost around $10. Thanks for reading and please follow us to stay updated!
Using a parallel-to-serial (PISO) shift register properly!
At the heart of our modular digital board game system is a parallel-in-serial-out shift register. But our earlier board design completely missed out the fundamental part that made the whole thing work: daisy-chaining shift registers is achieved by connecting the Q7 pin on one to the DS (serial data) pin on the next.
And we'd completely forgotten to connect the Q7 pin to our ribbon connector!
Here's the new PCB layout with the extra pin connected (there's probably a neater way to do this, without having to cross the traces over each other with 0ohm resistors but without a complete re-write, this is next best thing!)
Our ribbon connector is now a 7-way plug. We've drawn it as a dual-row 10-way IDC connector only because these tend to be quite common in the "real world" and are more easily sourced (and cheaper too) than lower pin-count connectors.
And we'd completely forgotten to connect the Q7 pin to our ribbon connector!
Here's the new PCB layout with the extra pin connected (there's probably a neater way to do this, without having to cross the traces over each other with 0ohm resistors but without a complete re-write, this is next best thing!)
Our ribbon connector is now a 7-way plug. We've drawn it as a dual-row 10-way IDC connector only because these tend to be quite common in the "real world" and are more easily sourced (and cheaper too) than lower pin-count connectors.
Monday, February 25, 2013
Adding glow to playing pieces
We're still on the fence over Dreadball, but it's looking like the ideal game to convert as part of our digital boardgame project. The Tron-like glowing edges are a big part of the game, so we thought it'd be pretty cool to create actual glowing edges on our playing pieces.
Edge light acrylic is often used for signs and is readily available. Basically, shine a light onto the surface of the plastic and it defracts in such a way that the edges appear to glow.
Now already we're thinking, since we decided to stop worrying about the cost of making our board game, adding a few more pence to the cost in order to add some surface-mount LEDs might be a cool idea. We could drill a hole in the centre of each square, connect the LED to the hall effect sensor (so it triggers when a playing piece is detected over the hole) and have the LED light up the base of the playing piece from underneath, which in turn is made from edge-light acrylic.
We've yet to find out if a hall-effect sensor can provide enough current to light an LED and hold an input pin on a shift register high (it should be able to, but we really need to try this out for sure) but in preparation of receiving our latest batch of goodies from Farnell, we've come up with a PCB layout:
Each of the seven hexagon shapes (we've drawn them as circles just because this was easier in ExpressPCB which we still prefer to use for knocking up quick prototype boards) has an SMT LED in the centre, with a tiny hall effect sensor slightly offset. The hall sensors we're using are these:
They're absolutely tiny - about 2mm by 3mm in total! In fact, these may prove to be a little bit too small for hand soldering, but they were the cheapest non-latching SMT-format sensors we could find and we'd ordered a load before even checking the dimensions, so these are the ones we're going to try out on our first prototype!
Every board has it's own shift register. We're trying these parallel-in-serial-out (PISO) shift registers:
Because we need to be able to hold the PE (parallel enable line) low and send a clock pulse to get the data from the input pins into the shift register, then pull it high to get the shift register to "pass the data along" on each clock pulse, we're having to send a few of these pins to a connector on the board.
So as well as the power and ground pins, every board also needs a serial data in line, a parallel enable line, a clock enable and a clock pulse line too. That's a 6-way connector. The easiest method we could think of, to allow all the boards to be laid out in any number of configurations, is to include a surface mount 0.1" pitch connector on the underside and to simply daisy-chain them together with some custom-made IDC cables.
Edge light acrylic is often used for signs and is readily available. Basically, shine a light onto the surface of the plastic and it defracts in such a way that the edges appear to glow.
Now already we're thinking, since we decided to stop worrying about the cost of making our board game, adding a few more pence to the cost in order to add some surface-mount LEDs might be a cool idea. We could drill a hole in the centre of each square, connect the LED to the hall effect sensor (so it triggers when a playing piece is detected over the hole) and have the LED light up the base of the playing piece from underneath, which in turn is made from edge-light acrylic.
We've yet to find out if a hall-effect sensor can provide enough current to light an LED and hold an input pin on a shift register high (it should be able to, but we really need to try this out for sure) but in preparation of receiving our latest batch of goodies from Farnell, we've come up with a PCB layout:
(a 2mm hole drilled through the centre of each pair of SMT LED pads will allow us to mount an LED "upside-down" on the board, so that it shines through the hole when viewed from the top side)
Each of the seven hexagon shapes (we've drawn them as circles just because this was easier in ExpressPCB which we still prefer to use for knocking up quick prototype boards) has an SMT LED in the centre, with a tiny hall effect sensor slightly offset. The hall sensors we're using are these:
They're absolutely tiny - about 2mm by 3mm in total! In fact, these may prove to be a little bit too small for hand soldering, but they were the cheapest non-latching SMT-format sensors we could find and we'd ordered a load before even checking the dimensions, so these are the ones we're going to try out on our first prototype!
Every board has it's own shift register. We're trying these parallel-in-serial-out (PISO) shift registers:
Because we need to be able to hold the PE (parallel enable line) low and send a clock pulse to get the data from the input pins into the shift register, then pull it high to get the shift register to "pass the data along" on each clock pulse, we're having to send a few of these pins to a connector on the board.
So as well as the power and ground pins, every board also needs a serial data in line, a parallel enable line, a clock enable and a clock pulse line too. That's a 6-way connector. The easiest method we could think of, to allow all the boards to be laid out in any number of configurations, is to include a surface mount 0.1" pitch connector on the underside and to simply daisy-chain them together with some custom-made IDC cables.
Dreadball like Blood Bowl but better?
It's been many years (about twenty more than we'd care to admit) since any of us played Blood Bowl. But always seemed like a nice idea for a game - even if the mechanics of playing it got a bit lumpy with all the rules and look-up tables. It's what originally inspired us to look into making a digital board game, just over a year ago; to take a complex set of rules and have a microcontroller do all the clever stuff, and leave us to concentrate on actually playing the game.
It'd also mean having a hobby that meant turning off the computer(s) for a while, and actually making and painting something - getting back to the arts and crafts side of making, rather than being engulfed in coding and electronics all the time!
While looking for ideas to resurrect the Digital Blood Bowl idea, the ever-helpful Mr Google turned up a relatively new game that launched recently thanks to some massive KickStarter support: it's called DreadBall and, while the author is keen to state that it's NOT Blood Bowl set in the future, on first glance it look like a perfect game to try to convert.
It's a two-player, futuristic, football-come-rugby-come-speedball type game, set in the future. The author - and subsequent players of the game - reckon it's easier and faster to play than Blood Bowl. In fact, all the reviews say it like Blood Bowl but better.
Now being set in the future, with Tron-like armour and shiny futuristic materials, this game lends itself really well to being converted into a digital board game - not least of all because the underlying technology won't need to be "hidden" behind a fantasy, olde-worlde facade, but actually enhances the playing environment. Some early fans have already taken the next logical step of creating custom boards - with LED backlights to reinforce the glowing-edges Tron-style look-and-feel:
In fact, players of the game are keen to exploit this futuristic look-and-feel. They're even painting it into the miniatures used for the playing pieces. The game ships with miniatures that have clear acrylic bases, so that they are less obtrusive on the board. But some players are making the hexagonal bases a major part of the model, painting them to look like they also have glowing edges:
This has given us an idea for our hex-based modular board game system. More details (with schematics once drawn) to follow....
It'd also mean having a hobby that meant turning off the computer(s) for a while, and actually making and painting something - getting back to the arts and crafts side of making, rather than being engulfed in coding and electronics all the time!
While looking for ideas to resurrect the Digital Blood Bowl idea, the ever-helpful Mr Google turned up a relatively new game that launched recently thanks to some massive KickStarter support: it's called DreadBall and, while the author is keen to state that it's NOT Blood Bowl set in the future, on first glance it look like a perfect game to try to convert.
It's a two-player, futuristic, football-come-rugby-come-speedball type game, set in the future. The author - and subsequent players of the game - reckon it's easier and faster to play than Blood Bowl. In fact, all the reviews say it like Blood Bowl but better.
Now being set in the future, with Tron-like armour and shiny futuristic materials, this game lends itself really well to being converted into a digital board game - not least of all because the underlying technology won't need to be "hidden" behind a fantasy, olde-worlde facade, but actually enhances the playing environment. Some early fans have already taken the next logical step of creating custom boards - with LED backlights to reinforce the glowing-edges Tron-style look-and-feel:
In fact, players of the game are keen to exploit this futuristic look-and-feel. They're even painting it into the miniatures used for the playing pieces. The game ships with miniatures that have clear acrylic bases, so that they are less obtrusive on the board. But some players are making the hexagonal bases a major part of the model, painting them to look like they also have glowing edges:
(note the Tron-like glowing edges painted onto the model bases)
This has given us an idea for our hex-based modular board game system. More details (with schematics once drawn) to follow....
Sunday, February 24, 2013
A new approach to digital boardgames
So far, we've been trying to build a digital boardgame to a budget. The idea being that keeping costs down makes the idea accessible to more people (not everyone can afford to drop a hundred pounds on a hobby project, but lots more people can find twenty or thirty quid for a one-off project).
This is why we were keen to pursue the LC oscillator idea for detecting board game pieces. It's already been suggested that hall-effect sensors would be a much simpler and more robust solution - simply place a magnet in the base of each playing piece and query each hall sensor on the board to see if it's been activated.
So far we'd ruled these out because they are relatively expensive. In truth, they're about 20p each when bought in bulk from somewhere like Farnell. But if you're building a board game with 390 of them on there, that's getting on for �80, which is a big amount to find to try out on an idea that a bunch of nerds posted on a website somewhere and which you still need to solder up and make yourself and still not know if it'll work 'til you've made it.
So we thought about this and came up with a different approach: a modular hexagon-based electronic game board. The idea is to make individual modules which can be plugged together to make a pretty-much any-sized gaming board for pretty much any board game. Provided it doesn't use squares ;-)
Each module could be a group of seven hexagons. Each module has a hall effect sensor in the centre of each "square", an 8-bit parallel in/serial out (PISO) shift register, a wired plug and a pin-socket which allows multiple squares to be connected together.
The idea is that the shift registers are "daisy-chained", with the hall effect pattern copied from the parallel interface (we're only actually using 7 of the 8 available bits) onto the serial output. As the microcontroller sends a clock signal to the first module in the "chain", the status of each square in each module is shifted out of the last module in the chain. Send enough clock pulses and the you get a massive binary pattery back, indicating the status of every square on the board. Provided every board is oriented the correct way around, we should be able to work out whether each square on the board has a playing piece immediately above it.
Now each individual module is going to be more expensive to manufacture than an entire board made from cheaper components - but the upside is that the same modules can be used for lots of different board games by simply unplugging them and re-connecting them in a different configuration for a different mcu!
Other than cost, the downside of this approach is that to create a rectangular playing area, there are quite a few unused squares across multiple modules:
Here's an example of a rectangular-ish board made up from hexagons - it's from a BloodBowl-esque game called DreadBall:
It uses up to 40 hex-based pads (including those with unused squares) which - if we go down the hall-effect sensor route - makes the total construction cost quite expensive. But already that's something that's already been queried by a few people...
After all, a brand new copy of Blood Bowl costs about �50 new. And that's made up of a cardboard playing surface and some plastic miniatures which most players replace almost as soon as they can afford to! If each module costs, say, �2 to make, a full DreadBall sized board would cost about �80. That's a lot to shell out in one go - but it's quite affordable (and much more realistic) to make up, say, 10 modules at a time. With only 10 modules, they can still be plugged together and used to confirm that everything works, but without the one-off massive cost of nearly a hundred pounds all in one go.
There's no guarantee that we'll ever make enough modules to complete a full-sized Blood Bowl board, but - like the LC oscillator - there's an idea that needs investigating. So we've got a load of components on order from Farnell to try out over the coming few days....
This is why we were keen to pursue the LC oscillator idea for detecting board game pieces. It's already been suggested that hall-effect sensors would be a much simpler and more robust solution - simply place a magnet in the base of each playing piece and query each hall sensor on the board to see if it's been activated.
So far we'd ruled these out because they are relatively expensive. In truth, they're about 20p each when bought in bulk from somewhere like Farnell. But if you're building a board game with 390 of them on there, that's getting on for �80, which is a big amount to find to try out on an idea that a bunch of nerds posted on a website somewhere and which you still need to solder up and make yourself and still not know if it'll work 'til you've made it.
So we thought about this and came up with a different approach: a modular hexagon-based electronic game board. The idea is to make individual modules which can be plugged together to make a pretty-much any-sized gaming board for pretty much any board game. Provided it doesn't use squares ;-)
Each module could be a group of seven hexagons. Each module has a hall effect sensor in the centre of each "square", an 8-bit parallel in/serial out (PISO) shift register, a wired plug and a pin-socket which allows multiple squares to be connected together.
The idea is that the shift registers are "daisy-chained", with the hall effect pattern copied from the parallel interface (we're only actually using 7 of the 8 available bits) onto the serial output. As the microcontroller sends a clock signal to the first module in the "chain", the status of each square in each module is shifted out of the last module in the chain. Send enough clock pulses and the you get a massive binary pattery back, indicating the status of every square on the board. Provided every board is oriented the correct way around, we should be able to work out whether each square on the board has a playing piece immediately above it.
Now each individual module is going to be more expensive to manufacture than an entire board made from cheaper components - but the upside is that the same modules can be used for lots of different board games by simply unplugging them and re-connecting them in a different configuration for a different mcu!
Other than cost, the downside of this approach is that to create a rectangular playing area, there are quite a few unused squares across multiple modules:
Here's an example of a rectangular-ish board made up from hexagons - it's from a BloodBowl-esque game called DreadBall:
It uses up to 40 hex-based pads (including those with unused squares) which - if we go down the hall-effect sensor route - makes the total construction cost quite expensive. But already that's something that's already been queried by a few people...
After all, a brand new copy of Blood Bowl costs about �50 new. And that's made up of a cardboard playing surface and some plastic miniatures which most players replace almost as soon as they can afford to! If each module costs, say, �2 to make, a full DreadBall sized board would cost about �80. That's a lot to shell out in one go - but it's quite affordable (and much more realistic) to make up, say, 10 modules at a time. With only 10 modules, they can still be plugged together and used to confirm that everything works, but without the one-off massive cost of nearly a hundred pounds all in one go.
There's no guarantee that we'll ever make enough modules to complete a full-sized Blood Bowl board, but - like the LC oscillator - there's an idea that needs investigating. So we've got a load of components on order from Farnell to try out over the coming few days....
LC Fail!
It's been an interesting, if not ultimately frustrating exercise, trying out using an LC oscillator as a miniature metal detector. The truth is, we didn't get the expected response from our board, even without any metallic pieces present.
A simple PCB connected each inductor and capacitor in parallel, which in turn were connected to a PIC i/o pin:
Here's the board all made up and connected to the PIC (ok, we only soldered four out of a possible eight squares, but it's just a prototype to prove a concept, so we're not too worried about that!)
We quickly knocked up some code to test the board. We're using XOR to detect which pins have gone high/low. This kind of thing often throws up some queries, so here's a quick explanation:
First we get the PORB input.
Let's assume it's 00011000
Now we XOR it with a previous read.
Let's pretend that previously the input was 00001000
So 00011000 XOR'd with 00001000 give us 00010000
This result tells us that PORB.5 has changed. Just by looking at the "before" and "after" port states, we can see that this is correct. So we've identified which pin has changed - but has it gone high or low?
If we AND the result with the "new" read data, we should get a pattern telling us which pins have just gone HIGH: 00010000 AND 00011000 gives us 00010000
Incidentally, if we AND the result with the "old" read data, we get a pattern telling us which pins have just gone low. We're not interested in this information right now, but it's a handy technique to know!
Now we've a way of telling, very quickly, which pins from an entire port have just gone high, we can use this to track how long it take for the oscillating LC part of the circuit to go from high, to low, and back to high again. Here's the code we used:
The idea here is that we send the output pin high, charging the LC circuit. We then turn the pin to an input, wait for the LC/input to drop to 0v, then time how long it takes before the oscillator takes the input high again. The results were quite unexpected:
A simple PCB connected each inductor and capacitor in parallel, which in turn were connected to a PIC i/o pin:
Here's the board all made up and connected to the PIC (ok, we only soldered four out of a possible eight squares, but it's just a prototype to prove a concept, so we're not too worried about that!)
We quickly knocked up some code to test the board. We're using XOR to detect which pins have gone high/low. This kind of thing often throws up some queries, so here's a quick explanation:
First we get the PORB input.
Let's assume it's 00011000
Now we XOR it with a previous read.
Let's pretend that previously the input was 00001000
So 00011000 XOR'd with 00001000 give us 00010000
This result tells us that PORB.5 has changed. Just by looking at the "before" and "after" port states, we can see that this is correct. So we've identified which pin has changed - but has it gone high or low?
If we AND the result with the "new" read data, we should get a pattern telling us which pins have just gone HIGH: 00010000 AND 00011000 gives us 00010000
Incidentally, if we AND the result with the "old" read data, we get a pattern telling us which pins have just gone low. We're not interested in this information right now, but it's a handy technique to know!
Now we've a way of telling, very quickly, which pins from an entire port have just gone high, we can use this to track how long it take for the oscillating LC part of the circuit to go from high, to low, and back to high again. Here's the code we used:
Define CONF_WORD = 0x3f32
Define CLOCK_FREQUENCY = 20
AllDigital
Config PORTB = Output
Dim i As Byte 'declare a variable
Dim portb_input As Byte
Dim portb_last As Byte
Dim portb_change As Byte
Dim portb_rising As Byte
Dim portb_response(8) As Word
Dim portb_final As Byte
Dim read_count As Word
High PORTB.0
Hseropen 9600 'open hardware uart port for baud rate 9600
WaitMs 1000 'this delay should be used in a real device
Low PORTB.0
i = 0
Hserout "Starting PIC: ", CrLf 'send formatted output to serial port
WaitMs 1000 'this delay should be used in a real device
loop:
'switch on timer 1
T1CON.TMR1CS = 0 '(use fosc/4 as time base)
T1CON.T1OSCEN = 1 '(enable timer1 oscillator)
T1CON.TMR1ON = 1 '(turn the timer1 on)
'make all of PORTB an output
TRISB = 0x00
'wait a sec
WaitMs 100
'make all PORTB inputs
TRISB = 0xff
'wait for the inputs to trail off to zero
portb_input = 0xff
While portb_input > 0
portb_input = PORTB And 15
Wend
'now reset the timer
TMR1H = 0
TMR1L = 0
'get the input from the port
portb_input = 0
portb_last = 0
portb_final = 0
read_count = 0
While portb_final < 15 And read_count < 1000
portb_input = PORTB And 15
portb_change = portb_input Xor portb_last
portb_rising = portb_change And portb_input
portb_final = portb_final Or portb_input
read_count = read_count + 1
If portb_rising.0 = 1 Then
If portb_response(0) = 0 Then
portb_response(0) = (TMR1H * 256) + TMR1L
Endif
Endif
If portb_rising.1 = 1 Then
If portb_response(1) = 0 Then
portb_response(1) = (TMR1H * 256) + TMR1L
Endif
Endif
If portb_rising.2 = 1 Then
If portb_response(2) = 0 Then
portb_response(2) = (TMR1H * 256) + TMR1L
Endif
Endif
If portb_rising.3 = 1 Then
If portb_response(3) = 0 Then
portb_response(3) = (TMR1H * 256) + TMR1L
Endif
Endif
portb_last = portb_input
Wend
'now write your results out over serial
Hserout "Read count ", #read_count, " "
For i = 0 To 3
Hserout "R", #i, ":", #portb_response(i), " "
Next i
Hserout CrLf
WaitMs 1000
Goto loop 'loop forever
Define CLOCK_FREQUENCY = 20
AllDigital
Config PORTB = Output
Dim i As Byte 'declare a variable
Dim portb_input As Byte
Dim portb_last As Byte
Dim portb_change As Byte
Dim portb_rising As Byte
Dim portb_response(8) As Word
Dim portb_final As Byte
Dim read_count As Word
High PORTB.0
Hseropen 9600 'open hardware uart port for baud rate 9600
WaitMs 1000 'this delay should be used in a real device
Low PORTB.0
i = 0
Hserout "Starting PIC: ", CrLf 'send formatted output to serial port
WaitMs 1000 'this delay should be used in a real device
loop:
'switch on timer 1
T1CON.TMR1CS = 0 '(use fosc/4 as time base)
T1CON.T1OSCEN = 1 '(enable timer1 oscillator)
T1CON.TMR1ON = 1 '(turn the timer1 on)
'make all of PORTB an output
TRISB = 0x00
'wait a sec
WaitMs 100
'make all PORTB inputs
TRISB = 0xff
'wait for the inputs to trail off to zero
portb_input = 0xff
While portb_input > 0
portb_input = PORTB And 15
Wend
'now reset the timer
TMR1H = 0
TMR1L = 0
'get the input from the port
portb_input = 0
portb_last = 0
portb_final = 0
read_count = 0
While portb_final < 15 And read_count < 1000
portb_input = PORTB And 15
portb_change = portb_input Xor portb_last
portb_rising = portb_change And portb_input
portb_final = portb_final Or portb_input
read_count = read_count + 1
If portb_rising.0 = 1 Then
If portb_response(0) = 0 Then
portb_response(0) = (TMR1H * 256) + TMR1L
Endif
Endif
If portb_rising.1 = 1 Then
If portb_response(1) = 0 Then
portb_response(1) = (TMR1H * 256) + TMR1L
Endif
Endif
If portb_rising.2 = 1 Then
If portb_response(2) = 0 Then
portb_response(2) = (TMR1H * 256) + TMR1L
Endif
Endif
If portb_rising.3 = 1 Then
If portb_response(3) = 0 Then
portb_response(3) = (TMR1H * 256) + TMR1L
Endif
Endif
portb_last = portb_input
Wend
'now write your results out over serial
Hserout "Read count ", #read_count, " "
For i = 0 To 3
Hserout "R", #i, ":", #portb_response(i), " "
Next i
Hserout CrLf
WaitMs 1000
Goto loop 'loop forever
The idea here is that we send the output pin high, charging the LC circuit. We then turn the pin to an input, wait for the LC/input to drop to 0v, then time how long it takes before the oscillator takes the input high again. The results were quite unexpected:
Using an inductor of 1.5mH and a capacitor of 3.3uF, we calculated that the oscillator should be running at about 71khz. But different input pins were returning different timing values. Something didn't look right! We took the board off the PIC and re-ran the code and the results were pretty much the same; the input pins were reading as if they were just floating!
One way to eliminate false reads from floating input pins is to add a pull-down resistor on each one. We did this and re-ran the code:
As expected (except, for some reason, the input on PORTB.1) once the input has gone to zero, it never comes back up to a positive value - any current in the circuit from the LC oscillator is being pulled straight to ground through the resistor.
Conclusion? Epic Fail :(
In fact it's not quite as bad as all that.
It's not a roaring success.
But for a while it was nice just to get back to making stuff and trying ideas out!
Saturday, February 23, 2013
Drawing Cars Once Again
Quite a few years ago I had a business where I created pen and ink drawings of British sports cars. Fourteen different cars in all. I went from selling drawings to t-shirts and finally to clocks. I was happy when the business took off in a big way and made me some money for all my efforts. I was actually having fun and shipping my wares worldwide. Which in itself was amazing that I could do such a fun thing and make money at it too. This was the good news as another one of my hobbies actually turned into a real money making business. The bad news was I was also working another full time day job and trying to run the business at the same time. It got to be more like working two full time jobs and I did not have enough time to create anything new for the business. Up at the crack of dawn and working until 9 or 10 every night got old quick. So after seven years I closed the British business down, took the cash I made and went on to other things. I got the urge over the past couple of days once again draw another car but this time a concept car. It's been some time but I think the drawing turned out pretty well for not having done this type of work in a lot of years.
As you can see from my efforts here and all the other things that I have posted on my blog that I have a wide and varied interest in a lot of different things. My son is very much like me in that respect and we are both on the same page when it comes to this subject. We both agree that it is not that we do not have anything to do. More like we have so much that we want to do that there is not enough hours in a day sometimes to deal with it all. That is a good thing I think. I'd rather be that way than never having a clue as to what you want to do in life and then regretting it later. Thank the good Lord that I am retired. Now I can play to my hearts content and keep my creative side moving forward. Hope you like the drawing. I'm already working on my next project. Have a good day tinkering, drawing, dreaming, planning, or anything else that puts a smile on your face.
As you can see from my efforts here and all the other things that I have posted on my blog that I have a wide and varied interest in a lot of different things. My son is very much like me in that respect and we are both on the same page when it comes to this subject. We both agree that it is not that we do not have anything to do. More like we have so much that we want to do that there is not enough hours in a day sometimes to deal with it all. That is a good thing I think. I'd rather be that way than never having a clue as to what you want to do in life and then regretting it later. Thank the good Lord that I am retired. Now I can play to my hearts content and keep my creative side moving forward. Hope you like the drawing. I'm already working on my next project. Have a good day tinkering, drawing, dreaming, planning, or anything else that puts a smile on your face.
Thursday, February 21, 2013
Robots to help at Fukushima Nuclear Plants
Over the next few decades, Japan will be integrating robots into its task of cleaning up the nuclear power plant mess at Fukushima. Some robots have already been developed. For example, a few tracked robots are equipped cameras and can be controlled via a computer. Others can dive right into wet environments that are hazardous to humans. Even major companies such as Mitsubishi have helped out by developing robots to get the job done. Lets just hope another accident doesn't happen between know and the clean up
Source: the video listed above
Another Day Another Simple IPad Project
I was working at my computer today and I wanted to look at some information that I had stored on my trusty iPad. This information was a PDF file that I needed to read that would help me with a procedure that I wanted to do on my computer. The problem that I had was that I could not hold my iPad up to read the information by itself. So another little project came to light immediately. I needed a stand to hold my iPad for me. There are probably hundreds if not thousands of IPad stands on the market but none of them in my home. Time to start designing one that I could print on my Makerbot 3D printer. This is what I came up with.
The stand is designed in three pieces so that it can be stored easily when not in use and if it got broken I could just replace the damaged part. The red cradle pieces hold my iPad easily and securely without my having to remove the protective cover that I have on it.
To assemble the stand all I needed to do was slide one of the keyhole shaped white arms into the receiving holes in the rear of each of the red cradles. These receiving holes a made just slightly larger so that the arms slide in smoothly with just enough of a friction fit to hold everything in place securely without struggling to assemble or take the assembly apart.
Array of LC oscillators for grid-based contactless input
With a load of inductors and capacitors on order, it was time to prepare a PCB for etching to see if this thing will actually work. Even now, we're not entirely sure that it will, but here's the theory behind our current approach:
We're going to dynamically add a ground to each "column" of sensors; the idea being that we can attach multiple oscillators to the same input pins, and activate only the column we want to read by giving a ground to the "left-hand-side" of the circuit. Instead of connecting and removing the blue wire, we're going to set an i/o pin to a high output, then turn it to an input. By turning the pin to a (high impedence) input pin, we're effectively removing the power source and setting the oscillator running.
Now we need to create a grid of sensors, attaching multiple oscillators to each i/o pin. Consider the diagram below (we're still not sure this will actually work, but this is the theory so far!)
Let's say we want to read the left-most column of sensors. We set the output pins on the shift register such that Q0 is low and Q1-Q7 are high. This means that the capacitors and inductors C1-C4 and L1-L4 have no ground connection and - in theory - are taken out of the "read" part of the circuit.
If we turn PORTB into an output and make the entire PORTB high, capacitors C5-C8 should begin to charge and only coils L5-L8 have a ground connected to them (capacitors C1-C4 and coils L1-L4 have no ground connection and should not be affected). Now let's concentrate on just C5/L5:
If we make all of PORTB an input, C5 should begin to discharge. But there's nothing stopping it discharging through coils L6-L8 as well as (or instead of?) L5. But if we make ONLY PORTB.0 an input, C5 should only be able to discharge through L5 (since L6-L8 has power still connected to the "right-hand" side of the circuit). So we should be able to read the time taken for the current to oscillate through L5 and use this to determine whether or not a metallic object is interrupting the magnetic field of L5.
We then turn PORTB.0 to a high output pin and turn PORTB.1 to an input pin and repeat for L6. After reading L6, we should be able to read L7 and L8 in a similar fashion.
Now presuming all this actually works, we should be able to adjust the output from our shift register, to make Q0 high and send Q1 low (keeping Q2-Q8 high). This in turn provides a ground connection for the right-most "column" of sensors only. By repeating the reading process, we should be able to detect the presence of metal objects above L1-L4.
At this stage, it's all supposition and makes a lot of assumptions. But there's only one way to find out if this will actually work - and that's to make up a PCB and give it a try!
We're going to dynamically add a ground to each "column" of sensors; the idea being that we can attach multiple oscillators to the same input pins, and activate only the column we want to read by giving a ground to the "left-hand-side" of the circuit. Instead of connecting and removing the blue wire, we're going to set an i/o pin to a high output, then turn it to an input. By turning the pin to a (high impedence) input pin, we're effectively removing the power source and setting the oscillator running.
Now we need to create a grid of sensors, attaching multiple oscillators to each i/o pin. Consider the diagram below (we're still not sure this will actually work, but this is the theory so far!)
Note the resistors on the i/o pins. Although the PIC has internal clamp diodes to enable it to cope with reversed voltage (from the inductors during oscillation) we need to have high value input resistors to protect the internal clamp diodes from too much current.
Let's say we want to read the left-most column of sensors. We set the output pins on the shift register such that Q0 is low and Q1-Q7 are high. This means that the capacitors and inductors C1-C4 and L1-L4 have no ground connection and - in theory - are taken out of the "read" part of the circuit.
If we turn PORTB into an output and make the entire PORTB high, capacitors C5-C8 should begin to charge and only coils L5-L8 have a ground connected to them (capacitors C1-C4 and coils L1-L4 have no ground connection and should not be affected). Now let's concentrate on just C5/L5:
If we make all of PORTB an input, C5 should begin to discharge. But there's nothing stopping it discharging through coils L6-L8 as well as (or instead of?) L5. But if we make ONLY PORTB.0 an input, C5 should only be able to discharge through L5 (since L6-L8 has power still connected to the "right-hand" side of the circuit). So we should be able to read the time taken for the current to oscillate through L5 and use this to determine whether or not a metallic object is interrupting the magnetic field of L5.
We then turn PORTB.0 to a high output pin and turn PORTB.1 to an input pin and repeat for L6. After reading L6, we should be able to read L7 and L8 in a similar fashion.
Now presuming all this actually works, we should be able to adjust the output from our shift register, to make Q0 high and send Q1 low (keeping Q2-Q8 high). This in turn provides a ground connection for the right-most "column" of sensors only. By repeating the reading process, we should be able to detect the presence of metal objects above L1-L4.
At this stage, it's all supposition and makes a lot of assumptions. But there's only one way to find out if this will actually work - and that's to make up a PCB and give it a try!
Wednesday, February 20, 2013
Point & Shoot Camera Sun Hood Project
Once in a awhile a project comes along and everything just seems to fall into place right out of the box. This has been the case with this little project that I put together yesterday. I had just finished a similar project for my video camera the day before yesterday when I realized that a sun shield could be made for my little point and shoot camera as well. So this is that project.
As with all of my projects that I create I start designing my ideas on my computer using my CAD software. In these three photos the camera and new sun hood were modeled using Inventor 2013 software. I modeled the camera in red only to show some difference between it and the sun hood. I really like the detail from the software that you see in these images. Leaves nothing to the imagination as to what I am trying to create.
Next I took the computer model that I created and converted the file to a STL (stereolithography) file that my Makerbot Replicator 3D printer could understand. The STL file is fed into the software for the printer where it is sliced into layers. These layers are read by the 3D printer. Each layer is only the thickness of six human hairs when it is printed. The new Makerbot Replicator 2 (I have a the first Replicator) prints at the thickness of only one human hair. That machine is on my wishlist for the Tinker's Workshop.
Here the camera and the sun hood are mounted together ready for use. The sun hood only weighs 1.5 ounces and cost just $2.25 to make including the cost of the small bolt to hold the hood to the camera.
The camera and sun hood now upside down shows how they are mounted together. The sun hood is held to the camera using a standard 1/4-20 bolt that is 1/2 long and threaded into the tripod mount. This holds everything together nicely and is simple to put on or take off the camera.
As with the video camera sun hood that I designed a few days ago this new sun hood for my digital camera will make a nice accessory. Both of them will make it a lot simpler to shoot photos and videos outdoors once again. The sun hood mounted to the camera still allows me to turn the camera on and off, zoom in or out, and of course shoot the picture. The hood also feels nice in your hands as it was printed all in one piece and is very smooth to the touch. Feels like a little digital box camera now.
The sun hood was made specifically for my Sony digital camera so I doubt that it would work on a different camera. Maybe but I doubt it. I would have to make the next version more universal so that it could be used on a lot of different point and shoot cameras. It's a thought but for now this will work with what I now own and so it fits my needs very well. So unless I get a lot of requests for this item I will hold off on designing a universal hood for now. Let me know your thoughts on this or anything else that I've posted and I'll be more than happy to hear from you and go from there. Have a good day tinkering.
2 year anniversary!
Today marks the second year that SimpleBotics had been running! I want to thank all of you. I thank you for supporting my blog. Since December, traffic has tripled. Check back tonight for a new post on robotics. Thanks!
Metal detecting for board game inputs
It's nearly the end of February and there's been very little coming out of Nerd Towers of late. Strictly speaking, that's not true, since we've been coding like the proverbial 1,000 monkeys at 1,000 typewriters (the output has been pretty similar of late too!). But software coding just doesn't feel like "making stuff" so we're determined to put that right.
While browsing the 'net the other day, looking for information about inductors (what they are, what they do, what they're used for) I stumbled upon this interesting animation. They say a picture speaks a thousand words; this one explained inductors and LC oscillators beautifully:
It came from this website: http://www.talkingelectronics.com/projects/Inductor/Inductor-2.html
Now in itself this demonstrates a fascinating property of inductors and capacitors when connected together. But then we came across this - http://www.schoenbuch-electronic.de/index.php?id=145
Which suggests that placing a metal object near an inductor affects the magnetic field and causes the frequency of the oscillator to change. Now that got us thinking:
If instead of the blue wire we connected the LC oscillator to a PIC i/o pin, we could set the pin to output mode and "charge" the circuit. After a delay, we could turn the pin to an input and set a timer running. When the input on the pin changes from low-to-high, we've got a means to calculate the frequency of the oscillator. We've ignored the negative voltage from the circuit because with PIC microcontrollers, every input pin has a clamp diode ensuring only voltages within the range 0-Vcc are accepted. In fact, a PIC is a pretty robust device and can handle really large +ve and -ve voltages (http://www.electro-tech-online.com/microcontrollers/96653-detecting-12v-pic-input-running-5v-off-7805-a.html ). The only thing we need to do is make sure the input diodes are protected by large value resistors.
So the principle is we send a pin high, wait, set it to an input then wait to see how long it is before we get a response back on the input pin. If the delay is larger or smaller than expected, we can confidently say that a metallic object is present. If only we could work out the "natural" oscillation of our LC circuit....
This website had just what we were looking for! http://www.deephaven.co.uk/lc.html
While browsing the 'net the other day, looking for information about inductors (what they are, what they do, what they're used for) I stumbled upon this interesting animation. They say a picture speaks a thousand words; this one explained inductors and LC oscillators beautifully:
It came from this website: http://www.talkingelectronics.com/projects/Inductor/Inductor-2.html
Now in itself this demonstrates a fascinating property of inductors and capacitors when connected together. But then we came across this - http://www.schoenbuch-electronic.de/index.php?id=145
Which suggests that placing a metal object near an inductor affects the magnetic field and causes the frequency of the oscillator to change. Now that got us thinking:
If instead of the blue wire we connected the LC oscillator to a PIC i/o pin, we could set the pin to output mode and "charge" the circuit. After a delay, we could turn the pin to an input and set a timer running. When the input on the pin changes from low-to-high, we've got a means to calculate the frequency of the oscillator. We've ignored the negative voltage from the circuit because with PIC microcontrollers, every input pin has a clamp diode ensuring only voltages within the range 0-Vcc are accepted. In fact, a PIC is a pretty robust device and can handle really large +ve and -ve voltages (http://www.electro-tech-online.com/microcontrollers/96653-detecting-12v-pic-input-running-5v-off-7805-a.html ). The only thing we need to do is make sure the input diodes are protected by large value resistors.
So the principle is we send a pin high, wait, set it to an input then wait to see how long it is before we get a response back on the input pin. If the delay is larger or smaller than expected, we can confidently say that a metallic object is present. If only we could work out the "natural" oscillation of our LC circuit....
This website had just what we were looking for! http://www.deephaven.co.uk/lc.html
If we type in an inductor and capacitor value, it works out the expected frequency of the circuit. Perfect!
So now we have a very basic metal detector circuit. What now?
About a year ago, we started work on an electronic board game (Blood Bowl). After hitting problems with capacitive sensing, not much more was done with it. But this latest development has got us thinking - the playing pieces in the game are (pewter) metal (but the same approach could be used for many board games, with a small piece of metal inserted into the base of the playing pieces). If we could use inductive sensing to detect when a piece is placed/removed from the board, our idea of a digital board game could well be back on! And coupled with the alarm clock audio player we came up with a few months back, could even include sound effects too!
Given that a chess board has 8x8 = 64 squares, and a board game has 300 or more playing squares, it's going to be important to keep costs down on this idea. So we're looking for
a) cheap inductors
b) cheap capacitors
c) accurate capacitors (there's no point using -20%/+80% caps to detect a 25% change in inductance!)
d) easy to use components (there's going to be a lot of soldering!)
So we came up with a shopping list.
These surface mount inductors from Farnell are less than 5p each in volumes of 100+
They're 1.5mH and accurate to 10%. They're in an 1812 surface mount package, so just a bit bigger than the SMT resistors we're already familiar with
These surface mount capacitors are 1.5uF, also accurate to 10% and cost less than 3p each.
They're also in the familiar 1206 SMT package so should be quite easy to work with.
If we use a 1.5mH inductor and a 1.5uF capacitor, in theory we should be able to create an LC oscillator which runs at about 100khz - ideally we could use "bigger" value components and get a slower oscillation; but a PIC micro running of a 20Mhz crystal should be plenty fast enough to read any variance in a 100khz signal, so we're trying to keep the cost down and use as cheap components as we can get hold of!
Using the components we've identified, each square on the board will cost 8p in components (not including the MCU or any external i/o expanders or shift registers). Although this isn't a massive cost, for anything more than a simple chess-type board, things could easily get very expensive, very quickly. For example, a Blood Bowl board is 15x26 squares in size: that's 390 squares. For just the inductors and capacitors, that's �31.20. Not a massive cost for a one-off prototype, but quite pricey if we ever decide to make more than one!
Before we go crazy buying up loads of kit and components, it's probably best to try the idea out with a few rows and columns on a board game board. That's exactly what we're going to do - and post the results here in a few days.......
Monday, February 18, 2013
Inexpensive Video Camera Sun Shield Project
Of all the times that I have tried to video something outside I always find it hard to see what I am looking at using the flip out screen on my video camera. The sun 99 times out of 100 will wash out the screen and it is just a matter of luck that I get the shot that I want to get even if I do try to shoot it. So over the past couple of days I played around with an idea that was stirring in my head to solve this problem using my 3D printer. The new attachment had to be light weight, easy to store when not in use, and also inexpensive. Plus it had to not look clunky on my video camera when I was using it. A tall list to be sure. So here is what I came up with.
The video camera (in red) has a flip out monitor. This is then enclosed with a collapsible sun shield made of light weight plastic (in blue).
The enclosure is held in place using two "C" shaped pieces (in yellow) again made of light weight plastic.
Here is a couple of views of the sun shield without the video camera inserted into it. To protect the video camera flip out screen from damage a soft padded recessed area on the top and bottom edges of the sun shield are added to the assembly. (Notice the black strip on the lower blue part in the image above.)
Here the sun shield is folded flat for easier storage when not in use. Once I had the design figured out I started printing the parts on my Makerbot 3D printer. This took about four hours to complete and the only additional hardware that I needed for the assembly was two 8-32 machine screws that were two inches long. That and about six inches of Velcro for the protective padding of the video camera flip out screen to slide on to.
Here is what the assembly looked like after I had printed all the parts on the 3D printer. The assembly is 3 1/8" tall, 3 1/2" deep, and 4 " wide.
This is what it looks likes once it is flattened out for easier storage. The machine screws hold the three main parts together through hinge points. This allows the parts to pivot so that they can be folded flat or at least nearly flat. In this configuration the upper assembly is 5 3/4" long, 3" wide, and 1" thick. The "C" shaped pieces stacked up would be 1/2" thick, 3" x 3 1/2" in size.
The dark strip in the top section of this piece is actually a strip of Velcro with the fuzzy side up. The upper and lower parts of the assembly that needed this strip have a 3/4 wide channel with a double lip on the outer edges that I was able to design into the part so that the Velcro could be slid into it. It was just the right size to hold the Velcro in place without glue yet not so tight that it was difficult to install. This makes a nice soft padded strip that rests on the top and bottom edges of the video camera's flip out viewfinder.
I was really glad that I printed the sun shield in black as it does not detract from the look of my video camera once it is installed. I weighed this new assembly and it is a very light 3.2 ounces! With it in place the flip out viewer still is able to rotate up or down freely and with the padding on the inside channels for the viewer of my video camera will not get scratched by sliding the sun shield on or off. The "C" shaped pieces have the right amount of pressure on the upper and lower parts of the assembly so that it will not slide off of the flip out viewer by itself if the video camera is tilted in that direction. So this was another goal met when working on the design.
This photo says it all. Here is a shot of what you see in only fairly bright sunlight without the sun shield mounted on the video camera. Poor at best. I know it will only get worse in absolute bright sunlight.
This is what can be seen using the sun shield on the video camera. What a difference! You can even read the icons on the screen. The best part about this project is that it only cost around $5.00 to make using my 3D printer and a couple of little machine screws. This will make taking video outside much easier and I will get the shots when I want to now without guessing if I got the shot at all.
With this project another idea has come to mind that ties right into this one. I also shoot still photos with my little point and shoot camera. You guessed it. It also has a video screen that is worthless in bright sunlight. So back to the drawing board once again to see what I can come up with for that camera. If I get it figured out I'll let you know about it here as usual. Until then I'll be outside shooting video! Stay tuned for further developments.
Subscribe to:
Posts (Atom)