Coder Social home page Coder Social logo

artem-smotrakov / esp32-ldr Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 8.86 MB

A demo project that shows how to read a light dependent resistor (LDR) on ESP32 with MicroPython.

Home Page: https://blog.gypsyengineer.com/en/diy-electronics/reading-photoresistor-on-esp32-with-micropython.html

License: MIT License

Shell 32.62% Python 67.38%
micropython micropython-esp32 diy electronics esp32 ldr-sensor

esp32-ldr's Introduction

Reading an LDR on ESP32 with MicroPython

This is a demo project that shows how to read a light dependent resistor (LDR) on ESP32 with MicroPython.

Check out this blog for details.

Components

  1. ESP32 development board
  2. A light dependent resistor (LDR)
  3. 10 KOhm resistor
  4. Breadboard
  5. Wires

Circuit

Circuit

Requirements

  1. esptool for flashing ESP32
  2. mpfshell for uploading files to ESP32
  3. minicom for connecting to ESP32 for debugging purposes

Uploading MicroPython and the code to ESP32

The steps below were tested only on Linux (Ubuntu 18 and 20). This may or may not work in other environments.

The directory scripts contains scripts that do the job.

Note that some ESP32 development boards require pressing the EN button while holding the Boot button for switching the board to the mode for erasing or uploading firmware.

First, erase the old firmware on the ESP32:

$ sh scripts/erase.sh

Next, upload MicroPython v1.13:

$ sh scripts/flash.sh
$ sh scripts/verify.sh

Then, upload the code to the board:

$ sh scripts/upload.sh

Finally, you can connect to the board with minicom and see the measured values of the LDR:

$ sh scripts/minicon.sh
value = 18.92552
value = 18.87668
value = 5.006105
value = 18.63248
...

Try covering the LDR with a hand or putting more light on it. See how the values change.

What it looks like

drawing

esp32-ldr's People

Contributors

artem-smotrakov avatar

Watchers

 avatar

Forkers

vtt-info vehar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.