Coder Social home page Coder Social logo

d03n3rfr1tz3 / ulp-pulse Goto Github PK

View Code? Open in Web Editor NEW
25.0 3.0 6.0 13 KB

Examples of using the ULP Co-Processor of the ESP32 with simple pulse counting, which I extended for also saving the shortest pulse.

License: Creative Commons Zero v1.0 Universal

esp32 ulp

ulp-pulse's Introduction

ULP-Pulse

Some short examples of using an extended version of the pulse counter from here: https://github.com/espressif/esp-idf/blob/master/examples/system/ulp/main/ulp/pulse_cnt.S

Besides count the pulses it also saves the shortest one. This enables some more use cases.

Requirements

These examples need an ESP32 and currently only work with Arduino IDE, which has to be extended with "ulptool": https://github.com/duff2013/ulptool

Wind Speed

First example for the extended pulse counter is the measurement of wind speed and wind gusts. While the ESP32 is in Deep Sleep, the ULP counts the pulses of an Anemometer. Combined with the timeframe of sleeping, the wind speed can be calculated easily. On top of that, the shortest pulse can be used to calculate the highest wind gust.

WINDFACTOR = 2.4     // 2.4 km/h per pulse defined by the Anemometer
TIMEFACTOR = 1000000 // factor between seconds and microseconds

Pulse Count Usage

float wind = (pulses / timeSleep) * WINDFACTOR

Shortest Pulse Usage

float windGust = (1 / (shortestPulse / TIMEFACTOR)) * WINDFACTOR

Rain Amount

Another example for the extended pulse counter is the measurement of rain and rain downpour. While the ESP32 is in Deep Sleep, the ULP counts the pulses of a Rain Gauge. The rain amount can be calculated easily, because each pulse of the Rain Gauge has a defined amount. On top of that, the shortest pulse can be used to calculate the extrapolated rain amount, which I defined as the rain downpour value. It shows how much rain would have been fallen, if the highest amount had been fallen the whole timeframe.

RAINFACTOR = 0.2794  // 0.2794 mm per pulse defined by the Rain Gauge
TIMEFACTOR = 1000000 // factor between seconds and microseconds

Pulse Count Usage

float rain = pulses * RAINFACTOR

Shortest Pulse Usage

float rainDownpour = (timeSleep / (shortestPulse / TIMEFACTOR)) * RAINFACTOR

ulp-pulse's People

Contributors

d03n3rfr1tz3 avatar nightbikeman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ulp-pulse's Issues

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.