A different wind vane

AllanBertelsen

Senior Member
I have been experimenting with a wind vane based on an angle encoder made of LED's and photo resistors. I have learned a lot and want to share. <A href='http://www.ab-it.dk/Filer/Windvane.pdf' Target=_Blank>External Web Link</a>
Using grey readings on a binary pattern makes the pattern analog. This must be useable in other projects.
Edit:
The most exiting graph did not appear in the pdf. Here is a link for a gif. <A href='http://www.ab-it.dk/images/readings.gif' Target=_Blank>External Web Link</a>


Edited by - AllanBertelsen on 06/08/2006 18:48:36
 

Jeremy Leach

Senior Member
Hi Allan

This was a pleasure to read ! It's so interesting to see the detail of other people's projects and refreshing to see your original thinking.

I particularly like your idea of using a cylinder. It must have been difficult to stick the pattern to the inside - also to ensure that the pattern seamlessly repeats inside the cylinder.

Your LED/LDR housings are great too - it really is a constructional work of art ;-)

I think It's a clever idea to use LDRs the way you have, even though you've already pointed out the major problem of slow response time.

Ok, so you could do the D-Type bit in a PICAXE and use 4 outputs - but your method uses two outputs with a simple additional chip (quad D-type?).

Another good thing about your design is that you only activate one LDR at a time, therefore keeping the overall current low.

One thing - it doesn't look like you've used Gray coding in your pattern. This is essential really as it ensures than ONLY one bit is changing in the pattern from one bit to the next. For instance , with a 2-bit pattern, the sequential binary numbers are: 00,01,10,11. But the Gray-coded sequence is : 00,01,11,10. See the difference?

If you don't use a Gray-coded sequence then at the boundary between two states (angular positions etc) then unexpected codes can be read because the LDRs won't all change their readings at precisely the same time !

Using an intermediate value of grey is also clever. I guess you use number <i>ranges </i> in code to detect whether an ADC reading is black, grey or white?

I personally think the best way to view this use of black, grey and white is that instead of using a binary pattern you are now talking in number base 3 - Which is interesting! And the same Gray-code rule should apply: You mustn't change more than one value between one angular position and the next in your pattern.

Anyway, I really like the creativity here. Even though the LDRs are slow response this whole idea may have uses elsewhere in a system where fast response doesn't matter.
 

AllanBertelsen

Senior Member
Hi Jeremy
Thank you for your comments, I really appreciate.

It's not really number base 3.
This is the normal binary pattern:
00, - , 01, - , 10, - , 11, etc.
If grey is X this is the binary pattern with grey readings:
00, 0X, 01, XX, 10, 1X, 11, etc.
Number base 3 would be:
00, 01, 02, 10, 11, 12 , 20, etc
If 1 is grey then the problem with base 3 is that the pattern will have transitions from 2 to 0 that can't be distinguished from 1.
In my setup, a higher order grey means that all lower order readings would be grey to. This eliminates the problem of timing between the patterns changing for more than one &quot;bit&quot; at one time.
If sensor 4 reads grey, then s3, s2, and s1 is set to grey to. By carefully setting the interval of grey, you can ensure that lower order &quot;bits&quot; also has shifted from white to black or from black to white when the higher order has made this transition.


Edited by - AllanBertelsen on 07/08/2006 08:06:19
 

AllanBertelsen

Senior Member
Hi again Jeremy
Just to answer the flip-flop question.
Yes I use quad D-type flip-flops. Actually I used a 74HC273 witch is contains 8 flip-flops but I am going to buy a handful of 74ALS175 witch is quad. They are so cheap. And I leaned a lot about digital electronic using these flip-flops. It should be used in school for LED chasers in stead of Johnson decade counters. There is much more to lean form flip-flop shift registers. When the kids have made each of their own LED chasers, they can chain them all together to make a huge one. They can send more complex signal as you are not constrained to lightning one LED at a time.

The PICAXE only uses 2 pins to control this. A third is needed for a regular shift-register. And the chain of flip-flops can be extended for what ever number that is needed without demanding another PICAXE pin.
 

Jeremy Leach

Senior Member
Hmmm, I need to think this through ;-) ...

<i>
This is the normal binary pattern:
00, - , 01, - , 10, - , 11, etc.
If grey is X this is the binary pattern with grey readings:
00, 0X, 01, XX, 10, 1X, 11, etc
</i>

I'm with you so far.

But If you arrange the binary pattern in a gray-code:
00
01
11
10

(Note: don't get confused by the colour 'grey' and 'gray-code', probably invented by Mr Gray !)

Now let's assign the base 3 (tertiary?) numbers as:
White = 0
Grey = 1
Black = 2

So the same gray code, with the intermediate positions, shown in base 3, becomes:

00
01
02
12
22
21
20
10

Which still only changes by one value each step (which makes sense). The same can be done for 4 bit binary Gray-code.


Edited by - Jeremy Leach on 07/08/2006 08:57:40
 

AllanBertelsen

Senior Member
Oh I did not know this Mr Gray. Bad research by me! But wow! It could improve my solution even more. I can still read the grey values. But now I will not have any problem with all sensors seeing grey at a time.
Thank you for this information
Now I must put another strip of paper into my cylinder and rewrite the code.

Edited by - AllanBertelsen on 07/08/2006 09:24:55
 

Jeremy Leach

Senior Member
Should work Allan. Good luck !

Actually, it was Frank Gray apparently !! ..
<A href='http://en.wikipedia.org/wiki/Gray_code' Target=_Blank>External Web Link</a>

Edited by - Jeremy Leach on 07/08/2006 09:51:40
 

AllanBertelsen

Senior Member
Yes - I just read that article. It got me googling for STGC. Single track gray code. I found this <A href='http://www.ahok.de/en/hoklas-code.html' Target=_Blank>External Web Link</a>. Here a two stripe solution with four sensors is described. So I might buy some phototransistors and build a new sensor-circuit as well.
 
Top