My project for now is almost the same as this: Arduino With Python: How to Get Started – Real Python. The only change is that in stead of the 10-bit analog pins on the Arduino, I want to use a 16-bit AD converter ADS1x15.
Eventually, I would like to plot analog sensor input versus time using Python's plotting packages. For that, I would always be running with a PC attached, leveraging its big screen,keyboard, and everything else. So I don't need to run micro-Python independently on the microcontroller, which seems to be a goal for CircuitPython.
With an UNO tethered to a PC, would it be possible to use ADS1X15 in Python code? If no ready-made package is available, what would it take to write one? Is there any references in that area?
pax_electronica:
My project for now is almost the same as this: Arduino With Python: How to Get Started – Real Python. The only change is that in stead of the 10-bit analog pins on the Arduino, I want to use a 16-bit AD converter ADS1x15.
[.....]
With an UNO tethered to a PC, would it be possible to use ADS1X15 in Python code?
This is a bit confused.
In the link you posted in Reply #2 it seems that the Python code is running on a PC (in which I include a RaspberryPi).
You should be able to write an Arduino program to collect data from the ADS1X15 as it seems to have an I2C interface.
Then you can have the Arduino send the data to a Python program running on your PC and the Python program can display the data. Note, however that you won't be "using ADS1X15 in Python code" - that will happen in Arduino code.
For communication between your Arduino and Python this Simple nRF24L01+ Tutorial should help get you started.
In the link further down, there is a "Reading Analog Inputs" example that shows how to access the analog pins on an UNO using Python from a PC. That is what I thought to be good enough, if only the AD converter has a higher resolution.
I have bookmarked your link. It is very interesting. The ADS1x15 runs well on UNO. Having it sending data to PC is certainly a good choice. Another is just upgrade to a Raspberry Pi, or a third choice is to write some code to make ADS1x15 such that it works more or less like analog pins on a UNO. What I want to find out is the feasibility of the last choice.
I apologize for my lack of knowledge on Arduino. I have been eyeing it for sometime but wasn't able to get to it.
Based on my very limited understanding, I find Arduino generally "hard to control", with its loop and delays. I want to have the entire system controlled from a proper computer, and having it tell the Arduino to perform simple tasks. In this case, I want to run the ADS1x15 from a PC using Python, not on an Arduino with C (or Python). The question is whether that is feasible, and if so, how.
I am aware that there are event based Arduino packages. They might help with controlling Arduino. But they are, again, all done in the Arduino, with the dinky processor.
The ESP32 is yet another choice. It looks very attractive: as cheap as Arduino if not cheaper, but much more powerful. CircuitPython FAQ has a question "Is ESP8266 or ESP32 supported in CircuitPython? Why not?". The answer is ESP8266 support was dropped, but did not mention ESP32. They are perhaps being intentionally vague.
pax_electronica:
Based on my very limited understanding, I find Arduino generally "hard to control", with its loop and delays.
Most people (me included) would advise you not to use delay()s in your Arduino programs. The loop() function is just a convenience to get things to repeat - for example to read the next message from Python.