Page 2 of 3

Re: DIY eboard for the forum

PostPosted: 21 Jan 2015, 17:36
by Revolt
Etching a capacitor and inductor is going to lead to some high frequencies which can vary quite a bit depending on etch accuracy and PCB material and temperature.
I am wondering if a surface mount capacitor(stable COG type) and and etched inductor, perhaps 10 mil spacing could yield more controllable frequencies and frequency spacing.

I can etch a sample and hit it with a pulse and watch the resonant ringing. Proximity would be an issue though, as would anyone wearing metal finger rings and such.
On the magnetic approach, I have neodymiums and linear hall effect sensors ordered. This is the hall sensor:OH49E @ about 0.20 ea from China...but they'll take a month or so to arrive. Plenty of time to study the RF approach and build a couple oscillators.
This will prob require some analog switches to create the grid, so as to have one oscillator cycling thru the 64 squares running thru a fast divide by 10 or 100 logic and feeding into the T0CK frequency counter input on the micro.

I did come up with a less elegant way to track the pieces....which I have tested already. A pair of 1/4" dia x 1/16" thick neodymiums embedded in the chess squares provide a direct electrical contact for an SMD resistor mounted in the base of each chess piece. It works very reliably and doesn't require calibration or anything. But it does require a pcb stuck on the bottom of the chess piece. No RF / EMI emissions to worry about either.

The magnetic approach and the RF approach allows the user to upgrade their boards with custom woods or finishes, perhaps with a hole for the LED light. A light pipe made of a cut off straw filled with wax works well to deliver the light into a hole in the squares. It provides a flat finish too that won't get dusty. I have super bright smd 5050 RGB LEDs on order for the job.

Re: DIY eboard for the forum

PostPosted: 21 Jan 2015, 20:13
by H.G.Muller
I was not thinking about etching the capacitors; that would give you just a few pF, and the resonances would all be in the VHF range. I was thinking more about frequencies around 1MHz, mounting a big fat capacitor on the component side, soldered to copper patches there (no holes, but the patches are so far apart that SMD would not work, and you would need capacitors with wires). They would form resonance circuits with the etched spiral coil. (These are indicated only schematically; I suppose it would be advantageous to have many loops there to drive up the inductance, so the copper traces and their spacing would probably be narrower than in the picture.)

The idea of having a spiral that continues pretty far inwards is to distribute the magnetic flux more homogeneously over the area inside the coil. For a simple wire loop the flux concentrates near the wire, but the inner loops create more flux in the center. In principle it should be possible to make the radial density of the loops vary in such a way that the detuning gets independent in lowest order from the exact positioning of the metal object relative to the center of the coil. Ideally only the size of the metal object would matter. Completely covering the spiral coil with a conducting sheet would make its inductance almost completely vanish. I was hoping the largest patch of metal used on a piece could reduce the inductance by a factor 4, reasonably independently of the the exact positioning as long as it is inside the loop, which would then double the resonance frequency.

The purpose of the outer guard loop is to confine the 'return flux' outside the spiral coil, which induces a counter-current in it (as it is short-circuited) that would keep the total flux through that outer loop zero, preventing the field to leak into the neighboring squares. This would basically cancel the magnetic dipole moment, so that the field would decay much faster with distance, making it much less sensitive to distant metal objects. That the guard loops are connected to the trace that feeds the outer side of the spiral coil is just incidental; it did not seem to gain anything by making them cross through a wire bridge.

If it is easy for you to etch such a coil and measure the resonance decay, it would be great. I haven't etched any PCB myself since I was a student in the eighties. Everything depends on how narrow the resonances are. Readout would be done by forcing a frequency-swept rf current of given magnitude through one (board-file-wise) series of resonatotors; those in resonance would hugely amplify the current through the coil, and as all magnetic flux of the latter passes through the pickup loop on the top side, the induced voltage there will increase proportionally.

What chips would you recommend to demodulate the rf signal, to detect which of the eight resonators are in resonance? Would it be better to have a dedicated modulator on each (board-rank) detection line, or would it be better to use an analog multiplexer to selectively connect one of the detection lines to the demodulator, and probe them one after the other? The resonances will need time to develop, limiting the rate of the frequency sweep. But I guess demodulation can in principle be instantaneous. (We could mix the driving signal with that from the detection line in a four-quadrant multiplier.) Anyway this is of later concern; first we should test if it works on a single square, and how many different piece tyoes we could reliably detect. If that looks good we could try a tic-tac-toe board :wink:, to test how bad the cross-talk problem is.

BTW, it would probably be better to rotate the spiral coils 45-degrees compared to the situation I have drawn, so that the wire from its center and the copper trace from the outside go towards the square's corner, where there is more room to connect the capacitor to a patch outside the guard loop.

As to the LEDs: did you plan to use one LED per square, or LEDs in the square corners (so that you would have a 9x9 array of LEDs)?

Re: DIY eboard for the forum

PostPosted: 21 Jan 2015, 21:10
by Revolt
My design is 8 x8 Linear hall sensors and 8 x 8 RGB LEDS. THE RGB would need 24 lines of control so i'd use 3 x serial to 8 bit parallel shift registers to add the additional control lines for full color. I do both thru hole and SMD prototyping, single or doublesided. The design calls for a 3.7 to 4.2V Samsung Galaxy Note 2500mAh rechargeable. There's a DC-DC boost converter to supply 5V to ensure proper LED brightness and standard logic levels even as the battery voltage drops.
I have a bunch of Aluminium polymer solid electrolyte super low ESR caps on hand, upwards of 470uF that should make efficient LC resonators. I'll do some LTspice simulations to establish the frequencies that I can build around those caps with etched inductors. I can etch a few inductors and measure their inductance across a reasonable temperature range, say 20C to 40C to establish the parameters.

The reason for the batt is eventual bluetooth or wifi ops. and the flexibility to be used by 2 human players with features like displaying opponent most recent moves as a handicap or displaying the range of valid moves per piece for new players. The board can also then archive the games into onboard EPROM for upload. With wireless it may be possible to get a remote chess engine to analyse during play as well. I'd hope for a wireless board to be able to play other wireless boards remotely via the internet, no PC screen required. Perhaps using instant messenger or something similar for coordinate moves.

Re: DIY eboard for the forum

PostPosted: 21 Jan 2015, 23:56
by H.G.Muller
Note that you could also switch the LEDs in a 16x12 array instead of a 24x8 array, perhaps saving one shift register. I don't know how many I/O pins the micro-controller you plan to use has, and whether they are a scarce resource or not.

Is there any reason to assume the inductance of etched inductors is very temperature dependent? I would expect not, if no magnetic materials are involved. This would be more of a problem with the neodymium magnets. (Or perhaps the capacitors.)

People playing Chess over the internet typically connect to Internet Chess Servers to find opponents. An alternative is to establish a peer-to-peer connection between two GUIs on different machines. (But this usually only makes sense for games that are not supported by any server.) If you want the board to function as an independent internet node, without the need for any computer, it would be best to let it communicate through ICS protocol, so that it can directly log on to an ICS. Then people cannot only play against other board owners, but to everyone else using the ICS, be it through an e-board or through a PC display. Opponent selection might be a problem, though. An alternative is to let the board directly use p2p protocol. Then it could play not only to other boards over a peer-to-peer internet connection, but also to people using the p2p pseudo-engine in a GUI, much widening the number of available opponents.

Re: DIY eboard for the forum

PostPosted: 22 Jan 2015, 15:39
by Revolt
The micro will most likely be a 28 or 44 pin unit doing 16 to 48Mhz.....I will try for 16 Mhz to conserve battery power.
I am looking at a PIC 18F44K50 or PIC 18F28J50 right now. For external EPROM I might use a few 24C512 chips off the I2C bus. FRAM memory is a bit expensive and the speed may not be necessary.

Re: DIY eboard for the forum

PostPosted: 22 Jan 2015, 22:54
by H.G.Muller
Interesting chip, very versatile. I guess at 16 MHz the timer2 on internal clock + PWM unit is just a bit too slow to be used as a frequency synthesizer to drive the rf resonators. The count rate would be only 4 MHz then. So even if the resonance frequencys are around 100kHz we have to divide by a factor ~40, which then can be modified in steps of 2.5%. That might just work if the resonances are perdictable (i.e. not temperature dependent and not suffering from component tolerances), so that we could tune to them by dividing by 40, 39, ...29 to scan the range from 100 kHz to 138 kHz in 12 steps, each on top of a resonance. This requires a maximum detuning of the inductance of a factor 1.9 by the presence of a piece.

100kHz is a pretty low frequency, though. And I would have preferred if it would have been possible to tune the exciting frequency in steps ~5 times smaller than the distance between the closest resonances, to make it possible for the board to calibrate itself at startup, establishing where the resonances really are.

Perhaps this is overdoing it, though, and having a frequency scan step of about half the resonance frequency spacing would already be good enough. That would guarantee you can always tune to a frequency that is at least 3 times closer to one resonance than to its neighbor. Phase-sensitive detection might help, though. On one side of the resonance the LC circuit reacts capacatively, at the other side inductively. The driver drives an rf current through it, so the voltage will either lead or lag by 90 degrees with that. This also holds for the voltage induced in the pickup loop. So by measuring the sign of the 90-degree phase shift on each board file for every driving frequency of the board rank, scanned in steps, it would be possible to decide between which two frequencies the resonance on each square occurs. So there is no need to excite very close to the resonances, their nominal position could just be exactly in between the frequencies of the scan. That allows a maximum error in the resonance frequency before it moves to the neighboring interval, and would be mistaken for another piece. If furthermore the A/D converter could be used to measure the magnitude of the response, I guess the software could fit a resonance curve through it to very precisely determine the resonance frequency, even if it did sample very close to it. (Only the Q factor would be ill defined from the fit, but that did not carry any information anyway.)

Re: DIY eboard for the forum

PostPosted: 23 Jan 2015, 03:14
by Revolt
Well I was thinking that I'd have a single RF colpitts oscillator with analog switches sequencing thru the 64 inductors. That way only the inductor is the variable in the tank circuits. The output of the oscillator is fed to the frequency counting input of the micro. Note page 153 in the uC spec sheet. ... 00684B.pdf

Each board scan counts 64 independent tank circuit oscillations for a precise fixed period, probably interrupt driven. If we aim for around a 200Khz oscillation (suitable for colpitts metal detection) with an inductor variance of 10% due to metal tag proximity we have a 20Khz range to work with to distinguish the different types of pieces. I'd look toward ensuring all the white pieces vary the frequency under 5% and all the black work in the 5-10% range.
If the board is scanned at 4 times per sec= 64 x 4 =256 samples per sec.
That works out to a peak frequency variation of 78hz within the sample time window so we're looking at a stepping resolution of perhaps 6Hz per piece. The resolution seems reasonable.

The Linear hall sensors / magnetic piece base would permit much faster board scanning as they output instantaneous values.

Re: DIY eboard for the forum

PostPosted: 23 Jan 2015, 11:17
by H.G.Muller
Just to make sure I understood you: 78 = 20kHz/256Hz is the number of resolvable frequencies within the sample period, and we only need to distinguish 12, so we have a safety margin of a factor 6.

BTW, I was hoping the pieces could detune the resonance more than 10%, because the pieces are basically inside the coil (perhaps ~5 mm away, the thickness of the wood finish plus PCB, from a ~20mm diameter coil), and of a size large enough to completely cover it.

The way I had imagined it would need to probe with 12 different frequency bursts on 8 ranks, so 96 probes. If we want to do that 4 times/sec, each probe can last 2.5msec, or 500 cycles of the 200 kHz driving frequency. As the frequency resolution needs to 0.83%, (20kHz/12/200kHz) the resonators need a Q of at least 120, so that it would take ~120 cycles for the resonance to develop. So the safety margin would be a factor 4 here.

Things could be sped up appreciably by doing several squares simultaneously: if we drive a short bursts of ~10 cycles of 210kHz through the resonators along one rank, it would excite them all about equally. The micro-controller could then observe the free decay of the oscillations, counting the zero crossings of all eight resonators for a duration long enough to distinguish them (4 msec to have a sefety margin of a factor 6). Because the 200 kHz is very much below the instriction rate of 4 MIPS, it could easily count in software by reading the signals on an 8-bit input port. This could then be repeated for the next rank, and after 8 ranks (32 msec) you would be done. Requirement is again that the Q factor of the resonators is large enough to follow the decay for 4 msec. This requirement would of course be relaxed if the detunings coukld be much more than 10%. (I was hoping for 40%, a factor 2 on the inductance.)

[Edit] I am a bit skeptical against the possibility to run the current that goes through the inductor through an analog switch, without totally spoiling the Q factor. The inductance of the etched circuit will be of the order of a uH, so at 200kHz its effective resistance will be 1.25j Ohm. The resistance of the switch will almost certainly not be negligible to that.

It also seems some sort of matrix design is preferable, to keep the number of components low. (Especially if the board gets bigger than 8x8.) The PCB layout I posted could also be used in 'oscillator mode', by multiplexing the output of the 8 'sense amplifiers' into one line, and then demultiplexing them to the input of the 8 drivers. By connecting the output of a selected sense amplifier to that of a selected driver the LC circuit on their intersection square would be set into oscillation. The multiplexing/demultiplexing would then be isolated from the resonators, and put in a place where analog switches can be tolerated, as the driver (or sense-amplifier) inputs are high impedance. The signal would always pass through the common line between multiplexer and demultiplexer, where the uC could count the frequency. The demultiplexer + drivers could just be a TTL decoder with OC outputs and an enable input; the latter could be driven by an op-amp connected to an 8-to-1-channel analog-switch multiplexer on its input.


Re: DIY eboard for the forum

PostPosted: 23 Jan 2015, 17:44
by Revolt
I'd say you're right on the analog switch killing the Q....they can be tens of ohms, they might even damp the oscillations off unless the amp gain was high.
Activating a selected column of inductors by selecting one of 8 dedicated column amplifiers (using 8 uC digital outputs) based on this Colpitts design
Rows can be selected by applying Vcc (8x uC digital outputs) to the R3,L1 node of each inductor row thereby driving a single oscillator with no Q losses.

For faster scanning, as u suggested, we can run the whole oscillator column (8) at once and simultaneously sample all oscillator outputs with 8 Digital uC inputs using the Interrupt-On-Change uC, PORTC IOC, feature for the 8 I/O as a means to count effectively.
So this should be about 8x as fast, 16 uC pins required (row selection and freq. sampling) . The potential problem here is I am not seeing a 8 pin dedicated IOC interrupt flags....
That may require polling the 8 pins of the frq. sampling port and using an XOR function to monitor each bit change and then have a running total for each bit in s'ware. This would prob. require an ASM subroutine loop for max speed.

Too bad these aren't cheaper..but they could be worth a try if we look at a 1 sensor to 64 inductor matrix

Might need to get one of these to eval:

Re: DIY eboard for the forum

PostPosted: 23 Jan 2015, 19:57
by H.G.Muller
Do I understand that you want to have one complete oscillator per square? I was already sour that it would need a dedicated capacitor per square.

Is there a special reason you prefer Colpitts oscillators? Because the feedback there runs through a capacitive divider these need extra capacitors, which need to be payed for and soldered on. While extra inductors would be simply etched in the PCB, and would thus be essentially free, as we need a PCB the size of the chess board anyway. Using inductors furthermore has the advantage that you can implement them as transformers, only picking up the current in the resonator itself, ignoring any (ac or dc) voltage offset the resonator might have as a whole (e.g. because it is switched in series with other resonators). There is no capacitive equivalent of a transformer.

The more I think about it, the more disadvantage I see of the rather low frequency of 200 kHz. For one, if we were at 2 MHz with the same fractional detuning, the whole readout process could be 10 times faster. It should be much easier to get high Q at higher frequency: The oscillation amplitude should freely decay as exp(-RT/2L) if L is the inductor's resistance, which is the same absolute time, and thus many more cycles at higher frequency. So aren't we making life unnecessarily hard for ourselves by using such a low frequency?

Re: DIY eboard for the forum

PostPosted: 23 Jan 2015, 20:59
by Revolt
For metal detection I saw a reference that 200khz is the top end, 1/10 oz metal nuggets requires about 100Khz. I suggested one oscillator per row...8 in all.
We can't count 2Mhz at 8 x without hardware counters. The processor only offers 2 hardware counters.

have a look at page 12 in this spec.

Details on Capacitor types for use with etched inductors.

Re: DIY eboard for the forum

PostPosted: 23 Jan 2015, 23:03
by H.G.Muller
I still don't get what you have in mind then. If there are only 8 oscillators, one of them selected by turning +Vcc (the L1,R3 node) on in the Colpitts circuit... How are you going to control that this oscillator uses the coil (L1) on the desired square on that row? What components beside L1 will be one per square? C1? Where and how will they be isolated from the oscillator when not in use? By an analog switch in the collector line of Q1?

Re: DIY eboard for the forum

PostPosted: 24 Jan 2015, 02:29
by Revolt
H.G.Muller wrote:I still don't get what you have in mind then. If there are only 8 oscillators, one of them selected by turning +Vcc (the L1,R3 node) on in the Colpitts circuit... How are you going to control that this oscillator uses the coil (L1) on the desired square on that row? What components beside L1 will be one per square? C1? Where and how will they be isolated from the oscillator when not in use? By an analog switch in the collector line of Q1?

I want to place a BISS bipolar optimized transistor between R3 and L1 , splitting the VCC node. This isolates the coil with only a 25mV drop. Call this new node Vcc1.

Vcc1 connects to all the other coils in the column of 8 oscillators, delivering Vcc-25mV for circuit ops. A row (8 cols) of these BISS transistors can activate each column A thru H of coils, one at a time creating outputs from all 8 oscillators (arranged as a column) at once. Scanning one entire column (A-H) of the 8 rows at a time or 8 columnar squares . Only inductors are required under a square.

Re: DIY eboard for the forum

PostPosted: 24 Jan 2015, 10:50
by H.G.Muller
Wouldn't it be a problem that the (L1,Q1c) node of all the 8 oscillators remains connected through all the other coils? Even though these are no longer connected to Vcc through this extra PNP transistor if the latter is switched off, they would still be connected to each other at the Vcc1 node. Wouldn't this give a very strong coupling between the oscillators, which would greatly shift their frequencies?

Re: DIY eboard for the forum

PostPosted: 24 Jan 2015, 16:09
by Revolt
Well, Vcc1 is very low impedance DC, it's not supposed to do a.c. coupling as a fixed rail, so I guess I'll have to test it but I don't think so.

If you think for a moment about running several separate oscillators from the same Vcc supply, they do run independently, not so?

Re: DIY eboard for the forum

PostPosted: 24 Jan 2015, 16:45
by H.G.Muller
If I understand you correctly, the 2x2 case would be this:

Code: Select all
    |_PNP2___________  | Vcc1(2)_________________      |
                       |        |               |      |
                      L1(1,1)  L1(2,1)       L1(2,2)  L1(1,2)
                       |        |               |      |
                       |--------+---> out  <----+------|
                  -----|                               |----
              b  /c    |                               |   c\   b
           ---- Q1    C1                              C1     Q1----
                 \e    |                               |   e/
                  -----|                               |----

PNP1 is on, and connects L1 of squares (1,1) and (1,2) to Vcc throug Vcc1(row1).
PNP2 is off, so the node Vcc1(2) is not supplied, but is a floating node only connected to the L1 of squares (2,1) and (2,2), effctively putting them in series. So an inductance of value 2L is now connecting the bottom of the row1 L1.

This strongly couples the oscillators, and creates an H-shaped resonator with two capacitors and 3 inductors. This H resonator has two modes, a symmetric one where the left and right vertical legs of the H oscillate locked in phase with the same amplitude, and because there is no voltage difference between the left and right end of the horizontal leg, it might as well not have been there. So the frequency of this mode is the normal one.

But the other mode is an asymmetric one, where the left and right leg oscillate in counter phase. This keeps the floating Vcc1(row2) node at their average, meaning it might as well have been grounded (for ac) This basically adds an extra inductor in parellel to the activated ones, halving their inductance. So the asymmetric mode shifts to a sqrt(2) higher frequency.

So instead of having two resonances at the empty-square frequency, which each can be perturbed slightly by presence of a piece, there will now be one at f and one at sqrt(2)f to be slightly perturbed. I am not even sure that oscillations at both of them would be sustained; more likely the whole set of oscillators gets phase locked in the mode with the lowest losses, each oscillator feeling all of the pieces, no longer being able to distinguish them by square.

Re: DIY eboard for the forum

PostPosted: 25 Jan 2015, 16:49
by Revolt
Well....not being an RF eng....I had a crack at simulating the LTSPICE.
I can get it to oscillate 'normally' ....12uH coil and 0.1uF Tank caps. Around 200Khz.

BUT once I place a transistor switch between L1/C3 it won't oscillate unless there is another cap across the CE of the switch tranny which generally screws up the whole approach.
Something to do with circuit stability in LC simulations being causing reluctance to oscillate I think.

SO next step ..prototyping I suppose to verify what's happening.

Re: DIY eboard for the forum

PostPosted: 28 Jan 2015, 01:31
by Revolt
This build/test will have to wait until next week. Gotta finish another project this week.

Re: DIY eboard- capacitive piece detection

PostPosted: 29 Jan 2015, 20:52
by Revolt
I am working on another project which requires capacitive touch sensing and it seems that the technique can detect objects as well.
Have a look at this: ... ve-sensing

Note Page 9 that discusses foreign objects & water affecting the touch pad.

Re: DIY eboard for the forum

PostPosted: 14 Feb 2015, 16:40
by Revolt
Have a look at this... ... EEVblog%29

Metal detecting based on oscillator amplitude rather than frequency. This might be useful by using an ADC sample of the amplitude to discern different metal masses in the base of the Chess pieces.