Giter VIP home page Giter VIP logo

esp32-sun-tracker's Introduction

ESP32-Sun-Tracker

Overview

The hardware prototype is described on hackaday.io: Sun Tracker prototype

The hardware schematic is the following:

Software for ESP32 is in this repository.

main.cpp

In the loop():

  • change LED blinking according to WIFI status
  • read the settings (max_error, sensitivity, update_period, start_time, stop_time) and apply them to the SunTracker object
  • call:
    • LED_loop
    • SunTracker.loop (only if now time is inside start_time and stop_time)
    • AutoConnect loop
  • config the local time (by NTP) using the TimeZone (at any time Internet is newly available)
  • enable / disable the sun tracking according to start_time and stop_time. It works only if the local time was set by NTP at least once after reboot.

AutoConnect

See also AutoConnect by Hieromon

  • Automatically start a WIFI hostpot (ESP32 softAP) with a captive portal at first run of if there's no connection to a WIFi hotspot
  • Let to connect to a WIFI hotspot
  • Reconnect in case of reboot or connection lost
  • Let to change settings with a web interface

drawing

SunTracker

In its constructor receives the pins where:

  • PDR1, PDR2, RELE1, RELE2, RUNEND1, RUNEND2 are connected

  • Read the two photo resistors: PDR1 and PDR2

  • Check if the average of PDR1 and PDR2 values is above the minimum required (sensitivity)

  • Compare their values with max_error

  • Activate the two relays to rotate the DC motor to a new position in which abs(pdr2-pdr1) < avg(PDR1,PDR2) * max_error/100

  • Stop both relays if one of the End-Of-Run is reached (closed)

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.