ads1x15-chip command not work
@Lazar-Demin I have found two faults with the ads1x15-chip code.
As a quick summary:
- The order of the bytes in the command sent over I2C was wrong - needs swapping
- Despite the documentation that indicates that the default max voltage range (used to set the gain) is 6.144 volts, if no max voltage is specified, then the gain value does not get explicitly set.
I have fixes for both these problems and have tested them and they work OK.
However, I would like to make some additional minor changes that would make the code easier, more user friendly, and more flexible to use.
If this is OK with you I will complete these additional changes before making my changes available.
@Kit-Bishop Good work!
I think it would be better for the community overall if the fixes to the current code were released as soon as possible, so people can get to tinkering with the ADS chips.
Would you mind creating a Pull Request with the fixes now and then another Pull Request later on with your additional changes?
@Lazar-Demin No problem, but .....
When I tried to create a pull request using GitHub in a branch with my changes, it was rejected for lack of permission on the repository. I assume I need to be authorised to do this.
Luciano S. last edited by
@Kit-Bishop , i guess you just need a actual fork from onion.io to put your changes from your repo in it (and pull request from this new fork). If both of you made changes on the repository, you not have the same versions anymore and a pull request is not possible.
@Luciano-S. Thanks for the hint, I am more used to creating branches in Git and working on that.
Have now successfully created a fork and committed my changes there and created a pull request on it.
@Lazar-Demin Have forked to https://github.com/KitBishop/onion-ads1x15-driver, committed my changes to it and created pull request:https://github.com/OnionIoT/onion-ads1x15-driver/pull/1
This covers just the basic bug fix changes. Hope it is what you want.
Will later do a change with the improvements I would like to see
Thanks @Kit-Bishop!! It looks great!
Looking forward to your improvements!
@Lazar-Demin Thanks for incorporating my changes - glad it's useful.
I have now created a new pull request (https://github.com/OnionIoT/onion-ads1x15-driver/pull/2) with some general improvements to the program. The changes are 100% backward compatible with the original and the new usage is described in the README file.
For reference, the new usage is:
Usage: ./ads1x15-chip [options] <channel> [max-voltage] <channel> Analog input channel, can be 0 to 3 [max-voltage] Optional: Set maximum expected input voltage If used over-rides -g option setting. Enter as a real number for maximum voltage. maximum usable is:6.144 minimum usable is:0.256 [options] - any number of: -q Quiet: no output -v Verbose: debug output -x Extra Verbose: all debug output -g<gain> Gain: gain to use. Affects maximum voltage measurable 0 - max voltage 6.144V - the default 1 - max voltage 4.096V 2 - max voltage 2.048V 3 - max voltage 1.024V 4 - max voltage 0.512V 5 - max voltage 0.256V -t<type> Type: the device type 1015 - 12 bit A/D - the default. Maximum raw data value 2047 1115 - 16 bit A/D. Maximum raw data value 32767 -o<output> Output: form of result output s - standard output giving channel number and raw data - the default r - raw data read m - data read in millivolts v - data read in volts -d Debug: do not carry out any I2C transactions
Luciano S. last edited by Luciano S.
Here you can see the Document with the changes, red the old version green what is new and white it is as it was.
In the end it is that was Kit-Bishop posted.
@Scott-Smith Don't understand how the README got linked in my post, I didn't link it to anything.
Anyway, ifyou want to see it, it is accessible at https://github.com/KitBishop/onion-ads1x15-driver/blob/master/README.md - though it doesn't say anything that isn't in my original post
2Luciano-s, thanks, that explains my confusion. @Kit-Bishop, this is timely and much appreciated, thanks for all your work!