Arduino Forum

Using Arduino => Project Guidance => Topic started by: 2Tricky on Oct 11, 2012, 01:26 pm

Title: SICK sensor and AD wobble
Post by: 2Tricky on Oct 11, 2012, 01:26 pm
OK so I have two SICKs (NT6) greyscale sensors where one is the digital trigger that tells the Arduino to read the voltage from the other - all working well except for AD wobble.

Being pretty new to just about everything 'electronics' I am experimenting with this and that: I have a 12V power supply measuring 11.94V ± under load with the load being both NT6's, the Arduino and my electronics, amounting to:

'Dividing' the voltage from the digital sensor from 11.94V to <5V
Restricting the analogue current with a resistor (Voltage range is 0..<3V before any tinkering)
Using a 4V7 zener diode to cut the 11.94V supply down as an attempt to smooth the reference in conjunction with the AREF pin (also uses 4K7 resistor in series to allow software reference switching safety)


My wobble problem manifests as readings varying between say 56 and 58  (parts of 1023) for a typical analogue reading where the 'test' colour is physically static and I am wondering about Earth/Ground/GND implications.

The wiring that 'works' (with wobble) has the plain divider (not the zener whatsit) connected to the power supply Blue wire (European hardware if relevant) and is in parallel with the GND on the UNO R3 'Power' section.   The bottom of the zener divider goes to the GND which is next to the AREF pin.  In addition the analogue is pulled down using around 9K Ohm - to the GND in the Uno's 'Power' section.

N.B. The zener setup (AREF) doesn't seem to have done anything to change the wobble either way (compared with setting the ref to DEFAULT) and I haven't bothered dividing by anything other than 1023 yet and of course that will only make the wobble appear worse.

I read a technique about making the processor go to sleep when taking AD readings but the C was unfamiliar (I need more practice) and don't yet understand how to use capacitors.  Incidentally I came across how to program the system to automatically calibrate to the AREF.  If anyone has an idea about what is wrong (and right!) I would be very grateful.

Thanks a lot 2Tricky
Title: Re: SICK sensor and AD wobble
Post by: AWOL on Oct 11, 2012, 01:46 pm
Quote
My wobble problem manifests as readings varying between say 56 and 58 

Not sure what you mean by "wobble" (or SICK NT6 for that matter, hint), but +/- 2 counts on a ADC reading is about right.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 11, 2012, 07:46 pm
Yup... SICK is the manufacturer and the NT6 is an optical sensor that views colours in greyscale, rather like a black and white photo.  Wobble is the inconsistent readings I'm getting which are in the region of ± 1 (56..58 out of the 1024 10-bit range).  Actually it is not known whether this is ±1, +2 -0 or +0 -2...and so whether additional wander is possible at the wave of a hand (not a metaphor) I can't say.  Neither can I say whether the mean value can change easily or what can (or perhaps what can't) make it change.

I'd really like to constrain this further because I would feel like I'm cheating to 'program' around it.  Perhaps an experiment with a battery will at least give me experience in this matter and I have to say, the idea of noise originating from processor activity makes me think this analogue business might be an art (based on science obviously!).

Thanks for the advice. 
Title: Re: SICK sensor and AD wobble
Post by: AWOL on Oct 11, 2012, 07:48 pm
Try taking multiple readings and averaging.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 11, 2012, 07:52 pm
Yeah, this is the cheating that I refer to... =(
Title: Re: SICK sensor and AD wobble
Post by: AWOL on Oct 11, 2012, 07:53 pm
You say "cheat", I say "sensible precaution"
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 11, 2012, 09:09 pm
AWOL is this mantra always applicable when the inconsistency is this small or should I try to improve the design - given that I really don't have much idea about earth loops and the like.  As this is my first experiment with anything electronic really, I'm all ears.  As you say, this result is not bad and so I guess I should begin to focus on what the implicatons are.  I'll take a look at what constitutes a shortfall in performance and what doesn't - given the right method of interpreting the result/s.

Just for your interest, there is really only one shot when it comes to reading the voltage from the sensor - this is because the colour is moving beneath it and any second read, should be labelled as 'second read' and compared with an 'ideal second read' value - at least this is my current thinking.

Thanks for the input, I'm getting a feel for the subject.
Title: Re: SICK sensor and AD wobble
Post by: PeterH on Oct 11, 2012, 09:12 pm
If your requirements are so close to the resolution of the ADC that a variation of one or two is important to you, you probably need to use a more precise ADC.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 11, 2012, 09:36 pm
PeterH I hear you.  However, given that I have a issue (or non-issue) with 10 bit, without the reduction in mV wobble, it will only get worse unless the greater resolution somehow shows up a frequency pattern wont it?

Cheers
Title: Re: SICK sensor and AD wobble
Post by: PeterH on Oct 12, 2012, 12:43 am

PeterH I hear you.  However, given that I have a issue (or non-issue) with 10 bit, without the reduction in mV wobble, it will only get worse unless the greater resolution somehow shows up a frequency pattern wont it?

Cheers



If the signal you're measuring is noisy, then increasing the ADC resolution will just give you a more precise measurement of the noise. Averaging is the way to filter that noise out.

I suspect in this case though, that you've simply reached the limits of the ADC and the noise you're seeing is quantisation noise and inaccuracies within the ADC and not a variation in the signal being measured.

If you use a higher resolution ADC it will still suffer from 'wobble' as you term it in the least significant bits but the magnitude of the wobble will be smaller. For example, if you have a 10-bit ADC you may see noise in the tenth bit caused by ADC inaccuracies. If you had a 20-bit ADC you would not expect to see noise in the ten most significant bits, although you may see noise way down the scale towards the twentieth bit.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 12, 2012, 09:03 am
Oh right. I was struggling a bit with what seemed to be a bad run of luck in that I felt the quantisation rounding was being 'invoked' far to often i.e surely I couldn't be that close to a threshold of 0.5 that often.

Given that you think the system is largely working healthily in its current guise, would you expect the only approach (when using 20 bit ADC) to be simple mean averaging or, do you think a Median or Mode function might be the route (in other words: might there be a pattern in the data).  A while ago I looked into ways to average because I thought it was at least something to consider, trying to find a library Mode function in C# (rather than rolling my own) to no avail and so hence an [additional] lingering reluctance to average - at least using C# (I'm using a PC to plot a graph in real time).

Thanks a lot PeterH
Title: Re: SICK sensor and AD wobble
Post by: PeterH on Oct 12, 2012, 05:54 pm
We seem to be presupposing that the noise matters. Does it actually matter if the chart (or whatever) shows a variation of 0.1%, or whatever? If you're trying to work at that resolution then you're pushing the boundary of the accuracy of a 10 bit ADC.

If you want to get the maximum possible resolution from that ADC, then since you're sending the data to a PC I guess your sampling frequency will be limited by the serial link rather than by the ADC speed. In that case you could simply take several readings per sample and calculate the average of the readings (i.e. sum and divide by the number of readings). It still won't be absolutely steady at all times. If you want to smooth everything out then you can average the readings over time (to produce a decaying average, or whatever other algorithm you want) but by eliminating the higher frequency variation you are losing data and this may not be what you want. It comes back to what you want the data for and what sort of accuracy, resolution, frequency and filtering you need to apply to achieve that.

Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 12, 2012, 07:58 pm
I think the first thing to do is to see what the averaged wobble means to the project.  I'll do some crunching and come back.

Thanks again PeterH
Title: Re: SICK sensor and AD wobble
Post by: MarkT on Oct 12, 2012, 10:57 pm

If your requirements are so close to the resolution of the ADC that a variation of one or two is important to you, you probably need to use a more precise ADC.


Under battery power the ADC is pretty well behaved (certainly noise below 1 lsb) - I suspect this is power supply noise - is the PSU a switching one?  Extra decoupling can help.
Title: Re: SICK sensor and AD wobble
Post by: Nantonos on Oct 13, 2012, 06:37 pm

Not sure what you mean by "wobble" (or SICK NT6 for that matter, hint),

So, just to be clear, this is the sensor we are talking about?

(http://www.vision-supplies.com/Data/Images/Products/im0001017.jpg)

Quote

Sick NT6-03022 Overview
Registration Control Scanner NT6-03022 lens No.211 (1004936)

Sick NT6-03022 Description

   LED light source with two switchselectable spectral ranges
   Lens position selectable
   Light- or dark-switching selectable
   Rapid response times

datasheet (http://www.vision-supplies.com/Product.aspx?pid=147514)


If so, it appears to be a contrast detector that switches between a high voltage and a low voltage output on detecting a dark (or light, depending how you set it) contrast change?
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 15, 2012, 09:14 pm
In principle this is the sensor but mine is a rare variant, NT6-03014 (from memory) with a 4m cable, which Sick has assigned a new part number to.

The beuaty about these great yester year devices (unlike many modern eyes) is that they were made with an anaolgue output too.  If you dig into the specs you'll find references to it: They have a green light and a red one and this topic ties nicely into the figures I've just recieved from the analysis as promissed.

Following my rationalisation of what matters and what doesn't, I have the following (all relative to 1024 values [10 bits]):
Set to the green light...
A glossy white mark: 75..77
A glossy black mark: 15..17

Set to the red light...
A glossy white mark: 201..204
A glossy black mark: 37..39

The key to this project holding water is a matter of the ratio of distance moved (image movement beneath the sensor) to ADC change.  The green gives around 0.1mm per count and the red around 0.01mm.

My conclusion is that 0.01mm is fine whereas 0.1mm isn't and unfortunately this is the best scenario as other colours produce a much smaller range.  Therefore I feel I need to continue refining.  I would be gratefull for peterH (author of 20 bit suggestion) or of course for anyone who knows some ins and outs of taking the 20 ADC bit route because I'm new to this and hoped my little Arduino would cope.

Thanks a lot all.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 15, 2012, 09:35 pm


If your requirements are so close to the resolution of the ADC that a variation of one or two is important to you, you probably need to use a more precise ADC.


Under battery power the ADC is pretty well behaved (certainly noise below 1 lsb) - I suspect this is power supply noise - is the PSU a switching one?  Extra decoupling can help.


MarkT sorry, I have little idea what a switching supply is but I can say that it is pretty cheap.  It is surprisingly accurate though despite this (compared with other supplies I've measured), reading 11.94 for a 12v supply.

Cheers
Title: Re: SICK sensor and AD wobble
Post by: retrolefty on Oct 15, 2012, 10:54 pm
The first thing I would try as a simple experiment would be to remove the external Aref voltage you are applying to the Aref pin and use the instead default internal Avcc reference and see if your wobble improves, gets worst, or remains the same.

Lefty

Title: Re: SICK sensor and AD wobble
Post by: holmes4 on Oct 16, 2012, 12:21 am
I tried a simple analogRead of a simple two resistor voltage divider and got "wobble", readings of 512 or 511. Your circuit is much more complex than mine!, so many more sources of wobble.

I think your in the area where real circuits and theory differ.

Possible sources of wobble a 1 part in a 1000 wobble.

1. The output from your PS is not as good as you think. If you looked at it with a very good 'scope you will find it varies even with no load, at mains frequency.

2. The load is never as constant as you think. A lot of chips draw more current on the rising/falling edge of the clock than in between.

3. Ambient light changes, some bulbs flicker at the mains frequency, this may be, just, enough.

4. Induction in that 4 meter cable (from near by mains cables) is the cable shielded?

5. Small changes in temperature.

6. Vibration.

Mark

Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 16, 2012, 09:39 am

The first thing I would try as a simple experiment would be to remove the external Aref voltage you are applying to the Aref pin and use the instead default internal Avcc reference and see if your wobble improves, gets worst, or remains the same.

Lefty


Lefty, Aref was only tried after suffering with wobble and made very little perceivable difference compared with the Unos' default 5V.  I should just check: When you say 'internal', do you mean something other than using the 'DEFAULT' Const when setting the reference in 'analogReference()'...this is how it was being used prior to using the Aref pin (although it was used by default, i.e. no specific call to 'analogReference()')...

Thanks Lefty
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 16, 2012, 09:55 am


4. Induction in that 4 meter cable (from near by mains cables) is the cable shielded?

Mark


Mark after I mentioned 4m, I thought that it might lead (no pun intended) to trouble.  In fact we have two NT6's in this embryonic system and the newer (recently bought - albeit an old model) was on my mind.  The irony being that this is the eye that is providing the digital signal, whereas the other analogue one has a miserly 10" ± (254mm ± in new money) of cable - both Sick cables are shielded.

N.B. In terms of which model the analogue NT6 is, I think it might be the ...22 as discussed in an earlier post.

Thanks Mark
Title: Re: SICK sensor and AD wobble
Post by: retrolefty on Oct 16, 2012, 03:58 pm


The first thing I would try as a simple experiment would be to remove the external Aref voltage you are applying to the Aref pin and use the instead default internal Avcc reference and see if your wobble improves, gets worst, or remains the same.

Lefty


Lefty, Aref was only tried after suffering with wobble and made very little perceivable difference compared with the Unos' default 5V.  I should just check: When you say 'internal', do you mean something other than using the 'DEFAULT' Const when setting the reference in 'analogReference()'...this is how it was being used prior to using the Aref pin (although it was used by default, i.e. no specific call to 'analogReference()')...

Thanks Lefty


No, I meant the DEFAULT mode with no analogReference command issued.
I worked with lots of ADC and DAC stuff in a oil refinery before retirement, so have some experience with trying to make quality analog voltage conversions in the real world. My opinion of the AVR 10 bit ADC is that it is very handy for hobby type projects and applications but falls pretty short of being a instrumentation quality measurement device. In todays world there are so many really nice and affordable external ADC chips and modules available and many are easy to interface to an arduino via SPI or I2C. So if accuracy, resolution, repeatability, common noise cancellation via differential inputs are important to your application I would suggest you look into external ADC converters.

Lefty
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 16, 2012, 06:07 pm
Lefty just in case I've negated a negative (!?), the first implementation displayed similar wobble without the function 'analogReference()' being called.

It's interesting what you say about alternative chips and I wonder whether you have any models in mind.  I admit that I'm trying to do this on half a shoe string, but a few quid of prudent expenditure is surely horses for courses.

Thanks for your view...
Title: Re: SICK sensor and AD wobble
Post by: retrolefty on Oct 16, 2012, 06:27 pm

Lefty just in case I've negated a negative (!?), the first implementation displayed similar wobble without the function 'analogReference()' being called.

It's interesting what you say about alternative chips and I wonder whether you have any models in mind.  I admit that I'm trying to do this on half a shoe string, but a few quid of prudent expenditure is surely horses for courses.

Thanks for your view...


The only one I've had first hand experience with on a arduino is the TI ADS1115 16 bit 4 channel (or 2 differential channels). http://www.ebay.com/itm/4-Input-16-Bit-I2C-Analog-Digital-Breakout-Micro-Controllers-Arduino-/330761041957?pt=LH_DefaultDomain_0&hash=item4d02e4f825

I have a check out sketch code available if you actual try one of these out.

Lefty
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 18, 2012, 12:26 pm
Lefty I'm amazed at how small the chip is, no wonder it's offered with a breakout board.  Do you happen to know of one that might be attachable to a breadboard so that I can experiment cheaply.  I appreciate that this is the only one familiar to you in an Arduino context, but guessing that I2C is I2C is I2C (unless perhaps it's revision 4 - I don't know) and provided I can get insight into the 'quality' of the chip, perhaps I could use another without much code change...

N.B. I have now tested the current AREF setup with a 12V battery.  Both Sicks were powered from it, as was the AREF (using a zener 4V7 to cut it down).  The signal from the digitally configured Sick used a simple divider to reduce 12V to around 5V and the analogue output was just as nature intended because it is low anyway (even though the specs say max 6V, I've never seen it above 3V and only then when it was 'blinded' by perpendicular light I think).  One thing though, the Uno was powered by USB which was still being used to give feedback to the PC.

Cheers
Title: Re: SICK sensor and AD wobble
Post by: dhenry on Oct 18, 2012, 01:36 pm
Quote
TI ADS1115 16 bit


Let me be the first to say that unless you are a very good engineer, using a 16-bit adc can be quite a challenge. And unless you are some analog god, using a 24-bit adc can be downright impossible.

Rather than increasing the bits, you should think if you need that much resolution and if that high of a resolution makes sense for your application (for example, is it even that accurate?).
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 18, 2012, 03:11 pm

Quote
TI ADS1115 16 bit


Let me be the first to say that unless you are a very good engineer, using a 16-bit adc can be quite a challenge. And unless you are some analog god, using a 24-bit adc can be downright impossible.

Rather than increasing the bits, you should think if you need that much resolution and if that high of a resolution makes sense for your application (for example, is it even that accurate?).



dhenry I think it will help if I clarify with a bit more context: The best scenario from the ratio of the 'image movement to ADC output' point of view is using the red light and comparing white with black marks. The technique used (so far) places the light half on one colour and half on the other colour, which provides the average greyscale as output.  To move from fully on one colour to fully on the other the image needs to travel around 1.5mm which provides less and less resolution the lower the relative greyscale values get.

As mentioned, 0.01mm per integer from the ADC is adequate, but 0.1mm isn't.  For example: If a small sheet (all sides are in centre vision) of paper has a black border of say 1mm, and a 0.1mm error occurs along one axis, one side will become 0.9mm and the other 1.1mm, meaning the smaller will be nearly 20% smaller which humans can see quite easily and may or may not hurt sensibilities (depending upon the nature of the onlooker!) and this assumes the conversion is accurate and doesn't suffer from noise etc.

It is also worth noting that my current quest is to measure any error rather than applying any correction (I'm treating subsequent correction as incidental).

You've got me worried though and I would appreciate some detail if you are in the position to do so...Thanks a lot
Title: Re: SICK sensor and AD wobble
Post by: dhenry on Oct 18, 2012, 03:36 pm
I don't know your setup that well but if you are using dividers or voltage references, think about what kind of resistors /Vref you will need in order to maintain the comparability of 16-bit adc from source to source.

With a good layout engineer and a good analog engineer, you may be able to get a 16-bit adc to work in the real world environment. But that requires a lot of work and luck. Most people end up doing is discarding the last few digits.
Title: Re: SICK sensor and AD wobble
Post by: PeterH on Oct 18, 2012, 04:06 pm

The technique used (so far) places the light half on one colour and half on the other colour, which provides the average greyscale as output.  To move from fully on one colour to fully on the other the image needs to travel around 1.5mm which provides less and less resolution the lower the relative greyscale values get.


This is the first time I've had any idea what you're using the A/D input for. Is it correct that you're using the dark/light contrast to find the position of a boundary between dark and light parts of an image?

How accurately can you position the sensor? Is it feasible to scan the sensor across the boundary? If so, I suspect you could get a much more precise position for the boundary by interpolating the position of the '50%' brightness point from a sequence of brightness readings in different positions rather than needing a single brightness reading to give you a hugely precise measurement of the proportion of dark/light areas within the image.
Title: Re: SICK sensor and AD wobble
Post by: retrolefty on Oct 18, 2012, 04:32 pm
Quote
Lefty I'm amazed at how small the chip is, no wonder it's offered with a breakout board.  Do you happen to know of one that might be attachable to a breadboard so that I can experiment cheaply.


Yes, that is why they supply those header pins pictured with the module, you solder the small pin ends to the module and then you can plug the module into any standard solderless or solder breadboard that uses .1" hole spacing.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 18, 2012, 04:45 pm

..Is it correct that you're using the dark/light contrast to find the position of a boundary between dark and light parts of an image?


That's right.

Quote

How accurately can you position the sensor? Is it feasible to scan the sensor across the boundary? If so, I suspect you could get a much more precise position for the boundary by interpolating the position of the '50%' brightness point from a sequence of brightness readings in different positions rather than needing a single brightness reading to give you a hugely precise measurement of the proportion of dark/light areas within the image.


Unfortunately 'not really' possible given that a big problem would be the inertia in the hardware used to accomplish a scan.  The material is moving at speeds of 20 fpm minimum (can be much faster) but in the direction that everything being equal (which of course cannot be so) will give a constant reading over the time taken to examine the analogue pin i.e. along the threshold of the two colours.  Hence there is really just one shot possible and it has to be the best effort.  In the current guise, a chart plots the result along the X axis as time passes.

I hasten to add: I have lashed together a temporary complete system to test the reliability of using a moving target and the result is indistinguishable from a completely stationary image and so I have no worries with a moving target in principle.  I should also mention: The duration that a consistent image will be available for under the sensor is as long as a piece of string in that it could start to be very different within say 1mm movement (prorata time elapsed and speed).


Thanks a lot PeterH
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 18, 2012, 05:19 pm
Lefty I appreciate that but I'm sorry to say I have even shallower pockets than that - of course I have to get it here too.  I'll see if I can get something for the fluff!
Title: Re: SICK sensor and AD wobble
Post by: dhenry on Oct 18, 2012, 05:59 pm
Quote
As mentioned, 0.01mm per integer from the ADC is adequate, but 0.1mm isn't.


I don't know what exactly you are trying to achieve but 0.1mm seems to be well below what a (untrained) human eye can detect.

Maybe you want to step back and see the minimum resolution / accuracy required and what that corresponds to a voltage signal for your adc and go from there.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 18, 2012, 06:03 pm

Quote
As mentioned, 0.01mm per integer from the ADC is adequate, but 0.1mm isn't.


I don't know what exactly you are trying to achieve but 0.1mm seems to be well below what a (untrained) human eye can detect.

Maybe you want to step back and see the minimum resolution / accuracy required and what that corresponds to a voltage signal for your adc and go from there.


I posted a little explanation of how the error can be magnified just now if you get a chance to read it but I'll do a little working backwards as you suggest too.

Thanks a lot.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 19, 2012, 10:28 am

I don't know your setup that well but if you are using dividers or voltage references, think about what kind of resistors /Vref you will need in order to maintain the comparability of 16-bit adc from source to source.


dhenry, I'm slowly working out the route of least resistance (metaphorically) and going over something you said...

Would you be able to explain what your references above mean - thanks.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 19, 2012, 11:17 am
Lefty I am probably getting the TI ADS1115 chip you mentioned but also found a thread here http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=111569&start=0 (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=111569&start=0) where 'oversampling and decimation' was discussed.

Is this worth considering or... From my point of view, I am aware that 2ms delay is suggested between analogue reads and then there is a 100µs or so required for an interrupt and would be grateful if you were able to comment.

Unfortunately I am very aware that the opportunity for oversampling is limited - in an earlier post I suggested that one shot is only possible, but needs must where the devil drives.

Here is the maths assuming a 0.5mm maximum permitted image travel 'window' (it is assumed that the image would not change shape beneath the sensor during this time):
Minimum speed... 20 feet per min = 6096mm per min
Time elapsed for 0.5mm travel... 4.92ms ±

Earlier I indicated that there would be 1mm of 'constant' image available and here I take 0.5mm to be the maximum.  Fact is, it is as long as a bit of string in that sometimes 0.5mm might not be available and so I have to play devils advocate.

Another aspect that I am aware of is the permitted frequency of AD reads from this chip and wonder whether, given that there will be an interrupt overhead too (Arduino), and that it will then issue commands over the bus and that the I2C bus is not the fastest (V4 doesn't seem to be available on this chip), will this scupper it?

I am clearly looking at the minutiae, which is not always the best route, but please comment if you have a view.

Thanks again.
Title: Re: SICK sensor and AD wobble
Post by: dhenry on Oct 19, 2012, 12:43 pm
For a 16-bit adc, the smallest difference it can detect is 1/2^16 = 0.0015% of Vref. For a Vref of 5v, that's about 75uv.

You will find that in an industrial environment, it is incredibly difficult to keep all kinds of disturbances to your circuit to be materially less than 75uv - typical smps has ripples of 10 - 100mv for example. You will also find that to make your software consistent from one build to another, your divider will have to be at least that accurate or you have to compensate for it in software.

What you are trying to achieve is very difficult from an engineering point of view.
Title: Re: SICK sensor and AD wobble
Post by: PeterH on Oct 19, 2012, 10:05 pm
It sounds as if, as well as being at the limit of how accurately it's feasible to measure an analog signal, you're also at the limit of how frequently you can take those measurements. This is not encouraging, and you may be constraining yourself into an intractable problem. I still feel that using a single brightness reading requires that reading to have unrealistically fine resolution and interpolating from multiple readings would enable you to get a better resolution.

One way to relax the precision requirements would be to reduce the size of the scanned area. That would mean you have even stricter requirements to get the scanner positioned in the right place and I don't know whether that's feasible.

Is it possible to give a more general explanation of what you're trying to achieve and what overall system this solution has to fit within? It may be possible to apply some lateral thinking, such as applying a vernier technique using multiple sensors, but without any idea what the thing is you're trying to measure the position of, it's hard to know where to start.
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 21, 2012, 11:03 am

It sounds as if, as well as being at the limit of how accurately it's feasible to measure an analog signal, you're also at the limit of how frequently you can take those measurements. This is not encouraging, and you may be constraining yourself into an intractable problem. I still feel that using a single brightness reading requires that reading to have unrealistically fine resolution and interpolating from multiple readings would enable you to get a better resolution.

One way to relax the precision requirements would be to reduce the size of the scanned area. That would mean you have even stricter requirements to get the scanner positioned in the right place and I don't know whether that's feasible.

Is it possible to give a more general explanation of what you're trying to achieve and what overall system this solution has to fit within? It may be possible to apply some lateral thinking, such as applying a vernier technique using multiple sensors, but without any idea what the thing is you're trying to measure the position of, it's hard to know where to start.


As often is the case, this project is relative to how things are currently which is without any feedback or automatic control at all.  It would be a shame for the final prognosis to be way under ambition but I don't expect that to happen...

The light 'spot' from these eyes looks something like 4mm x 1.2mm (fuzzy edges) and my experiments have placed the spot so that 4mm x 0.6mm is on one colour and 4mm x 0.6mm is on the other and a 0.5mm image movement would not in principle change this.  Unfortunately, turning the sensor through 90 degrees would transform the available sampling 'window' but wouldn't be possible most of the time because the images will not always extend far enough, which is a prerequsite of a linear greyscale to position formula. Another unfortunate byproduct is a worse position resolution relative to greyscale (albeit potentially linear) for any image regardless (we can't win).

You mentioned the accuracy of sensor placement in an earlier post and I think it is worth mentioning that it is not important to put the sensor exactly half on half off the image and this is because only a 'piece of string' reference is required i.e. the inital value will become the 'ideal' and any wander is an error.  Ultimately a mV:position ratio will be used to provide user friendly info and of course for any automatic correction (another project using steppers perhaps - I'm excited).

N.B. The current guise takes the first n readings and provides a plot of both extremes and the mean average over which the ADC output is ploted.

I am pleased to say that I have ordered the 1115 chip/breakout that Lefty suggested because I have to get my hands dirty with electronics per se and think it will be instructive to observe the outcome for our project using our hardware in our environment etc.  I hasten to add, this project suits me down to the ground - I've always wanted to marry up programming and machinery and get into electronics proper.  I'm trying to learn DesignSpark too (now V4) with varying success.

Thanks peterH
Title: Re: SICK sensor and AD wobble
Post by: 2Tricky on Oct 21, 2012, 11:09 am

The only one I've had first hand experience with on a arduino is the TI ADS1115 16 bit 4 channel (or 2 differential channels). http://www.ebay.com/itm/4-Input-16-Bit-I2C-Analog-Digital-Breakout-Micro-Controllers-Arduino-/330761041957?pt=LH_DefaultDomain_0&hash=item4d02e4f825

I have a check out sketch code available if you actual try one of these out.

Lefty


I'd like that please Lefty, I've plunged.  Thanks a lot 2Tricky.