piBeacon: presence monitoring plugin discussions

Posted on
Sat Oct 08, 2022 8:09 pm
GlennNZ offline
User avatar
Posts: 1563
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

GlennNZ wrote:
Hi Karl,

Hope you have finished unpacking! (I don't think anyone finishes unpacking....)

Have a few feature requests/and/or bug /inconsisteny reports for you.

1. ADS1115 sensors device. Please consider adding a SPS setting.

Had an issue were my ADS1115 sensor values would bounce up and down and up and down. 400--31000 - making the particular sensor usable.

Tried the basic library as below and got different readings to some extent would also bounce .
But found if changed readings per second ADS1115 setting could stablise completely. Obviously seems to be sensor dependant.

Managed to setup mysensors.py and use ADS1115.py - using this simple library
https://github.com/ncdcommunity/Raspber ... on_Library

With that got stable readings: Wasn't sure why at the time - but it worked/job done.

Found and used mysensors.py (thanks for that :D and all was good)

Revisited it now - when a old sensor died and had to replace. Had the same issue, except even more bouncy.

Looking into it in more detail it comes down the the SPS/speed value; it would seem.
I have to set it to 16 or 32 readings per second - to get stable, accurate values.

It appears the ADSL11x5.py code defaults the sps to 250 readings/second - with no way to change?
Manually dropping this seems to stabilize my readings.

Now stable (yah!) but still not completely sure why different readings from these code bases ADS1115.py and ADS11x5.py but as long as stable/internally consistent not necessarily an issue.

With old library ADS1115.py - the below does seem to follow:
Code: Select all
Note: Set ADS1115 gain to two to read 0-20mA signals.
When resolution is set to 16bit
at 4mA the raw ADC value will be around 6430
at 20mA the raw ADC value will be around 32154.


mysensors.py using ADS1115.py above code = get a reading of 17983.0 (with quite a bit of accuracy) 2.048V/16SPS
vs
ADS1115 Device C=0,M=16,G=2048 (ADS11x5.py code edited for SPS of 16) get raw reading of 1122.44 for example


2. Add INPUTMax/InputMIN to mysensors devices

I think I just added them to the mysensor device subtype and your plugin code cleverly recognised and populated!


Thanks!

Glenn
Hi Karl

Hope you have finished unpacking!

I upgraded a relatively old python2 pibeacon install, with slight trepidation it might be said …. but all good! Installed, running fine, no major issues..

Only minor issue is I had added Input0_Maxtoday/mintoday etc to mysensors device config - as above.

If it suits and have time to review above at some point that would be great.

Thanks!


Sent from my iPad using Tapatalk

Posted on
Sun Oct 09, 2022 3:39 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Glenn,

Yes we have settled down: I can open / close garage door (and position of garage do0r (0...100% in 10 % steps) , front door from phone and BLE beacons .. can set radiator temperature with shelly TRVs, that seems to work fine,. and the Philips hue lamps and controls work

re ADS 1115 I think , I have lost mine during the move - have ordered new ones from amazon.de should arrive Monday or Tuesday. Will spend some time on them then.

Karl

Posted on
Sun Oct 09, 2022 10:31 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Glen,
I found one in teh sensor boxes and have tested with my std power supply at different voltage:I have tried several voltage inputs levels
Code: Select all
09-18:19:02 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1916.06}}
09-18:19:04 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1921.13}}
09-18:19:06 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1921.69}}
09-18:19:08 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1921.5}}
09-18:19:10 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1919.81}}
09-18:19:13 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1918.13}}
09-18:19:15 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1916.81}}
09-18:19:17 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1914.19}}
09-18:19:19 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1919.06}}
09-18:19:21 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1921.69}}
09-18:19:23 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1921.88}}
09-18:19:25 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1921.13}}
09-18:19:27 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1920.75}}
09-18:19:29 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1920.75}}
09-18:19:31 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 1923.0}}
09-18:19:33 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 782.63}}
09-18:19:35 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 256.13}}
09-18:19:37 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 385.31}}
09-18:19:39 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 386.06}}
09-18:19:41 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 386.06}}
09-18:19:43 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 385.88}}
09-18:19:46 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 385.88}}
09-18:19:52 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3836.44}}
09-18:19:54 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3537.94}}
09-18:19:56 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3025.69}}
09-18:19:58 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3026.63}}
09-18:20:00 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3026.81}}
09-18:20:02 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3027.0}}
09-18:20:04 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3027.94}}
09-18:20:06 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3027.94}}
09-18:20:08 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3026.06}}
09-18:20:11 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3027.56}}

09-18:20:13 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3027.94}}
09-18:20:15 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3028.88}}
09-18:20:17 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3028.88}}
09-18:20:19 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3027.75}}
09-18:20:21 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3030.38}}
09-18:20:23 ADS1x15         getValues            L:532  Lv:20 getValues   inp:[u'0'],  v:{u'1697729290': {'INPUT': 3029.25}}

I don't see any instability in the readings ( the 1-2 mV variations are well with the expected range.)
and the values are +-1mV the the same as measured with a regular DVM

Could you share your exact setup ie the circuit. May you add a capacitor ( ~1uF) between the Vin pin and ground . That should remove noise on the line.

Karl

ps all with gain/range== 6144 mV

I also check w 2 channels and channel 0-channel 1
All within 1-2 mV as compared to DVM

Posted on
Sun Oct 09, 2022 2:13 pm
GlennNZ offline
User avatar
Posts: 1563
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

HI Karl

Thanks for having a look. It’s been a while since i looked as well but thought came down to speed of readings and the SPS setting.

I’m using a Ncd.io ADS115 current Loop sensor connected to a 0-20ma Stainless pressure sensor (discussed details in a water level tank thread) that sits on bottom of tank.

https://store.ncd.io/product/2-channel- ... ni-module/

I believe the issue is the speed of readings setting.

The pressure sensor can’t supply the 32,000 per/second that it defaults to - and until I drop it doesn’t become stable.

Hence the SPS option request?

The second quoted bit - Part 2/
Is the super easy part - which was addicting Input0_Maxtoday etc states to the mysensor device.

Thanks!


Sent from my iPad using Tapatalk

Posted on
Sun Oct 09, 2022 2:25 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

The ads…py program reads the ads chip once per second( adjustable between 0.2….xx seconds)

From Where do you get the high frequency ?

Karl




Sent from my iPhone using Tapatalk

Posted on
Sun Oct 09, 2022 2:30 pm
GlennNZ offline
User avatar
Posts: 1563
Joined: Dec 07, 2014
Location: Central Coast, Australia

piBeacon: presence monitoring plugin discussions

kw123 wrote:
The ads…py program reads the ads chip once per second( adjustable between 0.2….xx seconds)

From Where do you get the high frequency ?

Karl




Sent from my iPhone using Tapatalk
Sorry

Thats probably a gross exaggeration looking at it now - various up to 856 / second.

https://github.com/ncdcommunity/Raspber ... on_Library

Thats the library with the device - which is easy to use with rpi.

When setup with pibeacon ADS - was getting different absolute readings and also unstable.

Installed and used above - quite different readings, but also unstable until I dropped down the speed of readings.
eg. ADS1115_REG_CONFIG_DR_16SPS or lower for reading.

This stabilise and worked.

Could then not work out how to implement this ‘SPS’ setting back in the pibeacon ADS115.

Have setup pibeacon mySensor’s using the above library - so all going well subsequently. Thanks for those!

Glenn


Sent from my iPad using Tapatalk
Last edited by GlennNZ on Sun Oct 09, 2022 4:26 pm, edited 1 time in total.

Posted on
Sun Oct 09, 2022 2:47 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

or you could use the ina219 module that converts a current to bits and is supported - and much cheaper, with the default 100Ohm shunt it delivers 4V at 40mA (set gain to 1) with 12 bit resolution = 4096 bits), no need to convert from current to volts to bits, just current to bits

could you email me your "my sensor.py" program?

Karl wachs me com


ps sorry the default shunt is 0.1 ohm. that needs to be replaced with a 100ohm

Posted on
Sun Oct 09, 2022 2:56 pm
GlennNZ offline
User avatar
Posts: 1563
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

Hi Karl

Thanks. Will do - away from rpi’s now for a bit - but before end of (my) day should get to you


Sent from my iPhone using Tapatalk

Posted on
Sun Oct 09, 2022 4:22 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

ok I have now a version where you can set sps

will post tomorrow

Karl
but please still send me your version, would like to compare

Posted on
Mon Oct 10, 2022 2:38 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

.. I was always reading spi not sps . It finally clicked

Karl

Posted on
Mon Oct 10, 2022 2:47 am
GlennNZ offline
User avatar
Posts: 1563
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

Hi Karl
Sent the mysensor, and ads1115 library py via email - hopefully had address right….


Sent from my iPad using Tapatalk

Who is online

Users browsing this forum: No registered users and 10 guests

cron