Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 22 in printed book and digital formats -- plus a one-year subscription (beginning with 23.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 23.3

FEATURE

Raspberry Pi Sensor Fun with ADS1115

Programming the ADS1115 with Xojo API2 and the Einhugur I2C Plugin

Issue: 23.3 (May/June 2025)
Author: Eugene Dakin
Author Bio: Eugene works as a Senior Oilfield Technical Specialist. He has university degrees in the disciplines of Engineering, Chemistry, Biology, Business, and a Ph.D. in Chemical Engineering. He is the author of dozens of books on Xojo available on the xdevlibrary.com website.
Article Description: No description available.
Article Length (in bytes): 21,920
Starting Page Number: 31
Article Number: 23303
Resource File(s):

Download Icon project23303.zip Updated: 2025-04-30 22:34:07

Related Link(s): None

Excerpt of article text...

The ADS1115 is widely used with sensors to read signals from pressure sensors, light sensors, and temperature sensors. Other applications include industrial automation, data acquisition systems, medical devices, environmental monitoring (such as humidity), embedded electronic systems that require high-resolution input, robotics, and audio applications for signal processing and sound capture.

Since the Raspberry Pi does not have an analog port or pin, it is common to use another device to read the analog voltage into the Raspberry Pi. Using the I2C communication protocol simplifies this process, as only a few wires are required to transmit voltage data. The ADS1115 is a popular 16-bit analog-to-digital converter (ADC). This article will guide you through programming the ADS1115 with Xojo API2 and the Einhugur I2C Plugin.

The ADS1115 has many advantages, including the ability to measure voltages up to 6 volts, the capability to measure raw voltage and differential voltage across two pins, and good sensitivity. Four inputs are available, and in this example, we will use a range of 0.0 volts to 3.3 volts, as this is the main power supply range of the Raspberry Pi.

Some configuration on the Raspberry Pi is necessary to interact with I2C using Xojo. Here are the steps.

Install I2C Plugin for Use with Xojo

It is presumed that a Raspberry Pi 4B or 5 is being used with the latest Raspberry Pi OS, and the program is running in 64-bit mode. This project uses Bjorn Eiriksson's I2C plugin, which can be downloaded online (https://www.einhugur.com/Downloads/Plugs/I2CPlugin.zip). More documentation is available at Bjorn's website (https://www.einhugur.com/Html/I2CPlugin/index.html).

...End of Excerpt. Please purchase the magazine to read the full article.