Making things do stuff

Tag: Android Things (Page 2 of 2)

Experiments with Google’s Android Things IoT platform

Measuring analog values with Android Things

Sometimes you need to read analog sensors in your IoT project. The values could be from light sensors, potentiometers, or other things that aren’t cool enough to get digital equivalents. The Raspberry Pi doesn’t have an Analog to Digital Converter (ADC) so you need to add one if you want to use analog sensors. In this experiment I’m going to add an ADC to the Raspberry Pi and use it from an Android Things project to measure analog values. The ADC I’ll use is the four channel, 8 bit PCF8591.

The Android Things PeripheralManager may get analog pins in future but for now it doesn’t, so I’m going to add the PCF8591 to the things-drivers library.

Two ADC channels

Hardware

  • Raspberry Pi 3 running Android Things preview image.
  • A PCF8591 on a breadboard or module like this.
  • A display of some kind (I’m using an LCM1602 and character LCD).
  • your trusty level shifter for connecting 3.3V Raspberry Pi I2C to 5V peripherals.
  • something to measure (I’m using potentiometers).

Continue reading

I2C with Android Things (Part 1)

Welcome to the first part in a two part series about using an LCD Character display with Android Things. In this part we’ll collect, partially explain, and wire together the hardware. In the next part we’ll setup the project in Android Studio and write some clever messages to the display.

The Android things I2C API enables you to communicate with I2C devices, such as the PCF8574, using java in an Android project. The PCF8574 is a port expander that lets you connect to peripherals over a relatively high speed serial bus to a controller. This reduces the wire count and pin usage. Common usage includes interfaces to buttons, keypads and displays. We will use the PCF8574 to connect a Raspberry Pi to an LCD Character display.

 

Character LCD driven by Android Things

Continue reading

Newer posts »

© 2025 android.geek.nz

Theme by Anders NorenUp ↑