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 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.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 21.6 ('Differences')
Instant purchase and download via GumRoad!


Rasp Pi Electronic Fun Part 4

Using LibGPIOD Interface for Raspberry Pi Electronics

Issue: 21.6 (November/December 2023)
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): 13,713
Starting Page Number: 35
Article Number: 21604
Resource File(s):

Download Icon project21604.zip Updated: 2023-10-31 23:50:57

Related Web Link(s):

t http://abyz.me.uk/lg/lg.zip

Excerpt of article text...

One shortcoming of the Raspberry Pi is that conversion of analog voltage to digital voltage is missing. This example is created using a MCP3008 chip through the SPI communication protocol. This example reads a voltage and displays the numeric value in a listbox (see Figure 1).

One of the ways that a sensor provides data is through voltage. As an example, lets say there is a thermometer which reads the temperature and sends the data as a voltage. If the range of the thermometer is 32 F (0 C) to 212 F (100C C), the voltage could change from 0 to 3.3 volts. If you know the voltage, then it can be mathematically easily converted to a temperature. This example shows how to read a voltage and convert it to a digital signal that can be displayed in a listbox control.

Electronics rely on different types of electrical communication to send and receive data. One of the common protocols is SPI - Serial Peripheral Interface. SPI communication has full-duplex data sent between a master device and a slave device. Full-duplex means that data can be moved in both directions simultaneously. The master device (Raspberry Pi) controls one or more devices or processes (Slave devices).

There are four lines which perform most of the work which are: 1) Master Out Slave In (MOSI), 2) Master In Slave Out (MISO), 3) Serial Clock (SCLK), and 4) Slave Select (SS).

A MOSI line transmits data from the master device to the slave device, while the MISO data line transmits data from the slave device to the master device. The rate of data communication is controlled by the SCLK (Serial Clock) line. An SS (Slave Select) line is used by the master device to select which slave device will be communicated.

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

Home | Store | Browse Published Issues | Customer Service | Contribute | xDevLibrary

Site Copyright 2002-2024 by xDev Magazine and DesignWrite.
Xojo is a trademark of Xojo, Inc..