Update README.md

Added a schematic screenshot to aid wiring
This commit is contained in:
Derisis13
2021-11-19 02:14:03 +01:00
committed by GitHub
parent a8b73399ef
commit d55e979270

View File

@@ -8,17 +8,20 @@ You'll need a router flashed with openwrt with at least 6 accesible GPIOs and cr
## Hardware (Soldering required)
First you need to wire up the opto-isolators in paralel to the pushbuttons on the remote (As most remotes have them multiplexed connecting the GPIOs directly to the MCU on the remote is not guaranteed to work.) You'll have to experiment with the polarity of the opto-isolators, there's no way I know to tell which should connect where without an oscilloscope/signal analyzer, but resoldering 10 joints is not a big deal. Here's a simplified schematic of what you need to do:
![Screenshot from 2021-11-19 00-30-00](https://user-images.githubusercontent.com/66648475/142525719-07685def-26b9-439b-a9ab-1a7f121b1b3e.png)
3.3V is 3.3V on the router, MCU reset is the reset pin of the microcontroller on your remote (look for it in the part's datasheet). You need to use any GPIO available to you, but take note which connects to which button, we'll use that later. You also need to connect the remote's ground plane with the router's ground.
## Macros
You also have some macros you'll need to change (and an enum too) to customize the code to your setup.
In main.c:
`FILEPATH` is the path (including filename) to your schedule file (more about it later)
`N_of_Shutters` is how many shutters (appliences) you want to controll
`rolltimelist` is a list containing the time it takes for your shutters to roll down from 0 to 100% in seconds (note that it's a few seconds shorter than the time it takes to roll up) Their index is one less than the channel they are programmed to (channel 0 is usually broadcast).
In shutter.h enum buttons:
`typedef enum buttons:` each action should be equal to the number of the GPIO pin connected to the button
In moving.c :
`RESETPIN`: replace gpio2 in the path with the gpio you connected reset to.
@@ -46,6 +49,6 @@ done
## NTP
In order to have the exact local time, you'll have to make sure you are connected to a working NTP server.
# compiling
# Compiling
As a last step you'll need a cross-compiling enviroment. Follow this guide on https://openwrt.org/docs/guide-developer/toolchain/crosscompile: set up an Openwrt buildroot enviroment, compile the suitable toolchain, export enviroment variables, use the compiled GCC to compile the code.
You're done! Now upload the code to the router, make it executable and there you have it!