Skip to content
Example LoPy projects: Hello World, Interaction with Sensors
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
HelloWorld
Luminosity-BH1750FVI
Microphone-SPW2430
.gitignore
LICENSE
README.md
lopy_pinout.pdf

README.md

LoPy Hello World and Sensors Introduction

Please Note: Work in progress

Summary

This repo contains sample code on how to start with LoPy prgramming and use some sensors with the LoPy microcontroller.

  1. Hello World (slightly extended)
  2. MEMS microphone
  3. Ambient light sensor

The sections below provide further information for each sensor covered

Hello World

The folder HelloWorld contains a sightly extended LoPy "Hello World" example. In addition to printing "Hello World" the demo also cycles through some colors using the LoPy onboard RGB LED.

MEMS microphone

The folder Microphone-SPW2430 contains a minimal MEMS microphone demo to measure noise levels using the LoPy onboard analog digital converter (ADC).

Links

Ambient light sensor

The folder Luminosity-BH1750FVI contains the sample code for the BH1750FVI luminosity sensor. The LoPy microprocessor taks over the I2C bus with this sensor.

The demo cosists of the following files

  • main.py: Prints the current luminosity every second on the console
  • bh1750fvi.py: Class for the I2Configuration for the BH1750FVI

I2C

The I2C bus has just two wires called SCL and SDA. SCL is the clock line. It is used to synchronize all data transfers over the I2C bus. SDA is the data line. The SCL & SDA lines are connected to all devices on the I2C bus. There needs to be a third wire which is just the ground or 0 volts. There may also be a power wire to feed the devices. In our case, 3.3V will do.

Hardware Wiring

On the BH1750FVI sensor side we use the following pins:

  • SCL
  • SDA
  • GND
  • VCC (3.3V power)

The wiring with the LoPy is as follows (LoPy to BH1750FVI)

  • P9 to SDA
  • P10 to SCL
  • GND to GND
  • 3V3 to VCC

Links

You can’t perform that action at this time.