Change the input PWM signal to another PWM signal output with an Encoder.
This project born when i bought my first laser cutter. It's not easy to set the PWM power, at the first time, according to the material you want to cut. So i want to create a small device to change the power during the execution.
Step 1: Componets Lists
For this project you need:
- 1 x Oled display, in my case I2C
- 1 x Arduino, in my case arduino mini pro for the small dimension.
- 1 x Trimmer with a button .
- 3 x 10k resistor, 2 for the pull-up of the trimmer and one for the pull-down.
In the pic of this step you see another Arduino mini pro, called laser, because i simulated the skills of the laser controller ( pwm in signal ) with this Arduino.
Step 2: Connections
Remember to connect the 3 resistors, pull-up and pull-down, in this schematic.
For the first time, i recommend to you to connect the second Arduino ( called laser in the before step ) to test if the code and the connection works together as well.
If you are more familiar with the schematic view, open the pwmTOpwm.svg .
Step 3: Arduino Sketch
You can easily copy my code from the GitHub page: https://goo.gl/RLfUpq
The main skills of this code is the integration of the "pulseIn" command, more info: https://goo.gl/LdbHwo
When you try to measure a PWM signal goes in to the Microcontroller you need to count how long the signal stay up ( or down ) in the period. You can use the "pulseIn" command.
If you try to plot the pulseIn signal you can see something unstable.
For fix this problem we need to use a median filter, in my case exponential moving average (EMA).
You can try this cool and easy filter with this example: https://goo.gl/TZgZjG
Don't worry, the filter is already integrated in the code :p .
If you are using the second Arduino ( laser ) you can upload in that arduino this example: https://goo.gl/GKMgqD
Step 4: PCB
I would like to crate a PCB for this project, with KiCad, and share it .
If i make changes to the PCB I will share them on GitHub page.