I will make just only one axis. See full part list also here on this link. For that we need the parts below. The motor with the encoder in quadrature, the H bridge driver, the Arduino with a potentiometer and the rest of components. For the motor you could get only the motor and then make your own gear system or buy directly the motor witha gear box. See the scheamtic for all the connections.
- 1 x Arduino NANO/UNO: LINK eBay
- 1 x DC motor with encoder: LINK eBay
- 1 x H bridge L298N: LINK eBay
- 1 x end stop SWITCH: LINK eBay
- 1 x Potentiometer 10 turns: LINK eBay
- 2 x smooth rod 8mm: LINK eBay
- 1 x lead screw: LINK eBay
- 4 x lineal bearing LM8UU: LINK eBay
- 1 x STL 3D files: LINK eBay
- 1 x GEARS: LINK eBay
- or motor directly with gear: LINK eBay
- Extra wire, solder, soldering-iron, breadboard, etc
I've mounted everything on a plywood baord. We also need some M3 screws for that or maybe some glue. Some lubrificant for the rods and lead screw also would be good.
Make the connections as below. Supply a different connection to the H bridge with enough current. Remember to share GND with all the modules. The End stop swithc will need a pullup and give a low pulse when the siwthc is pressed, otherwise you will need to change that in the code. The encoder needs 5V, GND and two encoder outputs
Copy the code from below or download it from the link. You will need to install the needed libraries. Go to the link below and find those libraries and install them to your Arduino IDE. Read all the lines in the code to understand more. The setpoint is given with the potentiometer but you could use Serial read for example and give precise values for the setpoint and see the results.
//Include the libraries we need
See the video for more information and see what options you have for the encoder, how to detect the pulses and so on. I hope you will like this project. Comment below and help the community. COnsider supporting me on PATREON.