This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I2C ADS1015 settings not working
#1
Openplotter 3
Openplotter-i2c 3.3.12
Rasp pi 4
ADS1015

Openplotter-i2c recognizes the ADS1015 and brings up settings.
After adding signalk key and ok the signalk data for that key is "null"
If "add raw data" is checked data is shown in signalk.
No other settings on the dialog appear to do anything.
The settings window has self populated with: "Range1 = 0|1700-> 0|16" with no other info.

Thanks,
Brad
Reply
#2
(2023-08-27, 01:26 AM)ragbagger Wrote: Openplotter 3
Openplotter-i2c 3.3.12
Rasp pi 4
ADS1015

Openplotter-i2c recognizes the ADS1015 and brings up settings.
After adding signalk key and ok the signalk data for that key is "null"
If "add raw data" is checked data is shown in signalk.
No other settings on the dialog appear to do anything.
The settings window has self populated with: "Range1 = 0|1700-> 0|16" with no other info.

Thanks,
Brad

It's not clear from your post which ADS1015 setting are "not working".

Can you  elaborate? what are you trying to do? Perhaps it's the same problem as when you last posted on this but come clarification might help.

I don't have an ADS1015 but I do use an ADS1115 and I don't see any problems with any settings.

Thanks
Reply
#3
(2023-09-24, 07:03 PM)baltika_no_9 Wrote:
(2023-08-27, 01:26 AM)ragbagger Wrote: Openplotter 3
Openplotter-i2c 3.3.12
Rasp pi 4
ADS1015

Openplotter-i2c recognizes the ADS1015 and brings up settings.
After adding signalk key and ok the signalk data for that key is "null"
If "add raw data" is checked data is shown in signalk.
No other settings on the dialog appear to do anything.
The settings window has self populated with: "Range1 = 0|1700-> 0|16" with no other info.

Thanks,
Brad

It's not clear from your post which ADS1015 setting are "not working".

Can you  elaborate? what are you trying to do? Perhaps it's the same problem as when you last posted on this but come clarification might help.

I don't have an ADS1015 but I do use an ADS1115 and I don't see any problems with any settings.

Thanks
The only way it works is if "add raw data" is checked and I then get raw data. Without raw data checked no data is sent regardless of any of the settings.
Also there is no documentation of what "Range1 = 0|1700-> 0|16" is. It self populates with this string but there is no clue as to what it means.
Reply
#4
OK I am surprised you only ever see "null" in the non-raw data although it is perfectly legitimate for a "null" value to be returned depending on the voltage you are trying to measure and the "Range1" definition.

What voltage are you trying to measure and with what gain setting for the ADS1015?

Unfortunately I only have an ADS1115 so cannot replicate your scenario exactly. Let me try to explain what I've discovered about the topic and address the point you make about "Range1".

Taking your points in the first post:

1. After adding signalk key and ok the signalk data for that key is "null"
2. If "add raw data" is checked data is shown in signalk.
3. No other settings on the dialog appear to do anything.
4. The settings window has self populated with: "Range1 = 0|1700-> 0|16" with no other info.

Addressing these in a different order as it makes more logical sense.

The “Range1 = 0|1700-> 0|16” is just a simple mapping between the output of the ADC to a completely arbitrary scale of 0-16. It is a linear mapping. Your ADS1015 is a 12 bit device meaning that it has a resolution of 2^11 (2048) bits. Let’s assume you have set the device gain to 1, corresponding to a maximum permissible voltage of 4.096V. The output from the ADS can only go from 0 to 2047 (2048 bits). This, the quantized value of the analogue voltage corresponds to the left hand part of the range defined above. But where does that 0|1700 come from when the ADC will output 0|2047? I’ve no idea for sure (I could have a good guess though) but it doesn’t really matter as you can change it if you like.

The right hand side of the mapping, 0|16, tells us where to map the quantized value. Here we have 0 mapping to 0 and 1700 mapping to 16 in a linear fashion. Let’s call this range 0 to 16 the mapped value. So for example, assuming we have set the gain to 1 (max voltage is 4.096V) if there is a voltage of 0V at the ADC input, that corresponds to the 0 quantized level and 0 as a mapped value (ignoring noise for the purposes of this exercise). If there is a voltage of around 3.4V, (1700/2048)*4.096,  then the returned mapped value will be 16. If you are trying to measure a voltage higher than 3.4V then a "null" will be returned. As it is possible to power an ADS1015 from 3.3V and you shouldn't apply any voltage to an analogue input more that a little over the supply voltage, then setting the maximum quantized value to 1700 is perhaps a warning that if the signalk returns a "null" that you're in danger of damaging the device - just a guess  as to why the 1700 and not 2047.

Signalk can receive three pieces of data as you know:

What you call the ”signalk key” above in item 1, this is always within the mapped range, in this case 0 to 16.

Raw “value”, this is the quantized output of the ADC, for the ADS1015 that means an integer in the range 0-2047. Item2 above. EDIT - see posts #5 and #6, the ADS1015 I have is actually returning 0-32767 BUT in 16 bit increments hence 0-2047 levels.

Raw “voltage” which is self evident, again, item 2 above

If you increase the voltage so that the maximum raw “value” figure defined in your range (1700) is exceeded then the “signalk key” value will return “null” because it falls outside the range it had been told to map to. It has no idea how to handle it.  However, raw “value” and raw “voltage” will both still be correct.

The first thought then is that there is no point in using the signalk key value when  you’ve got the voltage in the raw data. I think that’s a reasonable conclusion.

However if for some reason you want to map the full range of voltage 0 to 4.096V assuming gain 1, then you can change the range in the dialogue box to "Range1 = 0|2047-> 0|16", that way you should not see a “null” value in the signalk figure for any voltage in the range 0 to 4.096V. Similarly if you want to change the mapped range to something else, say I don’t want 0 to 16 I want 0 to 24 then just change the range definer in the dialogue box to "Range1 = 0|1700-> 0|24"

The remaining item in your list that has not been covered yet is the assertion that “no of the other settings on the dialog appear to do anything”.

Well they do, assuming you mean the offset and scaling factor. These both modify the mapped value, if you leave them at 0 and 1.0 respectively then the base mapping remains unchanged at
0|1700-> 0|16. These two factors modify the right hand side of the mapping range.
Offset adds or subtracts a fixed amount from each reading and the scaling factor multiplies each reading by a fixed number.

Here’s how that manifests itself:

Defined mapping range         offset      scaling factor      Effective mapping range
Range1 = 0|1700-> 0|16      0             1.0                    Range1 = 0|1700-> 0|16
Range1 = 0|1700-> 0|16      1             1.0                    Range1 = 0|1700-> 1|17
Range1 = 0|1700-> 0|16      0             2.0                    Range1 = 0|1700-> 0|32
Range1 = 0|1700-> 0|16      1             2.0                    Range1 = 0|1700-> 1|33

There are plenty of permutations.

All of that said, I don’t really see a case where you would need to use the mapped number (your signalk key) when the voltage you wish to measure is there in the raw data. I would welcome enlightenment on that point though as it must have been done for some reason.
Reply
#5
I've managed to get an ADS1015 and yes I agree with you, there is something wrong. I can also say that it is nothing to do with Openplotter.

Although the ADS1015 is a 12 bit device, mine (Adafruit) is actually returning 16 bit values. I suspect yours is doing the same. It means that when measuring any voltage higher than around 0.212V you will see a "null" value returned. I've validated this using a simply python program outside of Openplotter and the figures returned there are the same as shown in signalk databrowser so I am confident of what I am seeing. Openplotter is only processing what it is receiving.

There are two ways around it, I've tried both.

1. If you configure your ADS1015 in I2C, change the range from Range1 = 0|1700-> 0|16 to Range1 = 0|32767-> 0|16
OR
2. Configure the device as an ADS1115 in I2C (I would suggest changing the range again though from Range1 = 0|27000-> 0|16 to  Range1 = 0|32767-> 0|16)

Either of those should work for you.

I will do some more testing to see if I can understand what is going on by using an ESP32 instead of the Pi. It is very puzzling.
Reply
#6
I've done some more testing with the ADS1015 connected to an ESP32 and it does indeed output values of 0-32767. however I can see that it is incrementing in 16 bit steps instead of single bit steps. So in terms of resolution it is a 12 bit device (correct for the ADS1015) but for some reason it seems to be masquerading as the higher resolution ADS1115.

That being the case if you want to use it in Openplotter I think the first option in my post above is the way to go. There is some tomfoolery going on with these chips but it isn't surprising these days. You might want to get an ADS1115 unless you need the higher sampling rate of the ADS1015.

At least I understand what is going on now. Very interesting problem.

But as I say, not an Openplotter problem.
Reply
#7
Thanks for the info.

 I had assumed that the 0:1700 etc etc was a mapping but why I2C plugin defaults to strange mapping numbers is a mystery. 

I have solved my initial problem though it brings up other questions. My initial problem was that the board I have, while it says ADS1015 it is actually ADS1115. After adding it as ADS1115 settings work properly.  So now for some questions:

I have found that the "range1=" setting is required. If deleted it will not send data so this scaling statement has to be there. Why is this required when there is a separate scale and offset setting input?

Also the "range1" suggests there would be a range2, range3 etc but this doesn't appear to be the case. What is the significance of "range1"?

It makes for strange scaling if you input both scale, offset and then the "range1=" inputs for sure.

Next question:

I don't see a way to change the ADS1115 control register to configure the multiplexer. I would think there would be a string to put in the settings window to configure the multiplexer (i.e. to use differential inputs instead of individual inputs). Is there a string to do that?
Reply
#8
I wouldn't be too sure that it is an ADS1115. As I said in post #5 bullet point 2. if you added it as a ADS1115 it will work. To check, just take a couple of random voltage readings fairly close together and see what raw "value" readings you get and post them here. That is a sure fire way to tell. Also have a look at the writing on the ADC package itself (you'll need a magnifying glass!) and there should be a four letter indicator. Bxxx.

Of course the Range is required. Range1 is just a starting point. The ADC has four inputs and you can configure them to have different ranges, so you might define Range2 for input A1, Range 3 for A2 etc.

The scaling and offset modify the Range settings so if Range is omitted they cannot work. You don't have to use scale and offset unless you have a projects which requires it but Range, yes.

The matter of making differential measurements is a problem. In the absence of documentation to the contrary I don't know what you can configure in the ADC apart from the Gain setting from Openplotter. You could contrive a sort of differential by subtracting the voltages measured on two ports but at the moment I am not aware that direct differential measurement has been implemented in OP.

At the moment then unless that does get implemented (maybe it is but the documentation is not available) then the best way to have full control over the device is by attaching it via an ESP32 or something like that as suggested in your earlier thread on the topic. I appreciate that you may not wish to add that complexity.

First though you need to absolutely clear what device you have per my first paragraph.

Good luck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)