1

I am currently working on a project where I need to convert a analog signal to a digital one therefore I am using an ADS1115 ADC Converter. This converter is connected to my Raspberry Pi Pico on a bread board. I am trying to run a basic test script from the Adafruit Github Site but I always get the same error: "ImportError: no module named 'adafruit_ads1x15'". Also I am using CircuitPython.

I really dont know why the error occurs because I installed the following Librarys through Thonny:

  • adafruit-bus-device
  • adafruit-circuitpython-ads1x15

After that I tried to run the following script and get the before mentioned error:

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

import time
import board
import busio
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn

# Create the I2C bus
i2c = busio.I2C(board.SCL, board.SDA)

# Create the ADC object using the I2C bus
ads = ADS.ADS1115(i2c)
# you can specify an I2C adress instead of the default 0x48
# ads = ADS.ADS1115(i2c, address=0x49)

# Create single-ended input on channel 0
> chan = AnalogIn(ads, ADS.P0)

# Create differential input between channel 0 and 1
# chan = AnalogIn(ads, ADS.P0, ADS.P1)

print("{:>5}\t{:>5}".format("raw", "v"))

while True:
    print("{:>5}\t{:>5.3f}".format(chan.value, chan.voltage))
    time.sleep(0.5)

YungT
  • 11
  • 2
  • Is the library present on your device? If yes: does it have the right size? In an other question I learned that Thonny sometimes has problems copying libs to the pico. – Peter I. Jun 16 '23 at 05:48
  • Hey @PeterI. Thanks for the answer, it indeed had problems with copying the library to the pico so I just copied it manually to the device and it works now! Thanks again and have a great day. :) – YungT Jun 17 '23 at 01:12

0 Answers0