So as not to make my video too boring, I didnâ€™t include a lot of details about the electronic circuitry that controls the motor which controls the feed rate of the drum sander. So here, Iâ€™m going to try to give more information. First, the schematic itself.
Just by looking at it, itâ€™s obvious itâ€™s not that complicated; a couple of components to power the microcontroller itself, 3 resistors (R1, R2, R3) and a capacitor (C5) for the current sensor transformer, several connectors for the LCD display (P2, P11, P3, P10), the current sensor transformer (P5), 12 volts input voltage (P1), a connector to plug the stepping motor controller (P4, P6), which is by itself an external module, a Bluetooth connector (P7) which I didnâ€™t use in the end, and finally a connector to program the microcontroller itself (P8).
This is the program I wrote to make it work.
First, the heart of all this is the AC transformer which detects the actual amperage of the motor. Hereâ€™s a short explanation: the coil acts as a transformer with its primary winding being one wire from the motor. The more amps pulled by the motor, the more AC voltage is produced at the output of the transformer.
You can check the basic drawing I did. So, to transform the motorâ€™s current into something a micro-controller can understand, I use a voltage divider with two 10KÎ© resistors and a capacitor of 220ÂµF. With those components, I get a half power voltage at one end of the coil. The 75Î© resistor is actually a load on the coil. The other side of the coil is connected to an analog input of the micro-controller. More current is drawn from the motor, so I get more AC voltage at the input of the micro-controller. To get the actual value, I constantly read the analog input and find the maximum and minimum readouts. I subtract the minimum value from the maximum and this way, I get the absolute value of the AC voltage. Using this value makes the rest of the programming move the stepper motor accordingly. So, with a big spike in current, the stepper motor turns a lot more than with just a small amount over the limit. I programmed for a 9 amperes limit because my drum sander motor is rated at 10 amps. So, if the current is over 9 amps the position of the stepper motor changes and changes the feed potentiometer position.
The rest of the programming is actually the reading of which button is pressed and the display. All the buttons are actually different tension divider like you can see on the actual display schematic. So reading which button is pressed is as simple as reading the analog input of one pin and figure out which button is pressed. The display is even easier. After plugging it to the micro-controller, I just use the display library from the compiler.
I also need to control the stepper motor, but this is super easy with the external module I used (MOT-28BYJ48 Stepper Motor w/ ULN2003 Driver). I just have a step sequence for the motor coil and send it in the right order for the rotation I need. And when the motor stops, I cut the power to the coils; this way the motor doesâ€™t overheat uselessly.
I also added a Bluetooth connector. I use it especially for debugging purposes, but I still have a couple of commands inside the program, for example to change the maximum current limit. So, with a Bluetooth module or a wire serial communication, itâ€™s possible to change the 9 amps limit to anything else, same thing goes for the idle motor current.
If you wish to have a little more details on the command, you can check out the source code.
I also modified my plan a little bit so an Arduino can be used instead of my dedicated PCB. But using an Arduino, implies that you have to use a prototype board sandwiched between the Arduino and the display. I also had to change the actual pin-out of my original schematic to accommodate the pin-out of an Arduino board. But the actual programming is almost all the same.
If by chance you want to try this controller with an Arduino, you have to know that I didnâ€™t do the programming with the Arduino IDE, but rather with Code Vision AVR, the program Iâ€™ve been using to program AVRâ€™s for the past 20 years. So, if you want to use it with an Arduino, youâ€™ll have to rewrite the code with the Arduino IDE or use my already compiled .HEX file and upload it to your Arduino. To do so, you can use Xloader. This is the official link or I have a copy on my website.
Here you can download all the sources code and the 4 .HEX files. 2 for my design, one with an LCD displsy and the other without. The same if you’re using an Arduino.
I also have a jpeg image of theÂ app I did usingÂ MIT App Inventor.
And the actual app I also have a QR code for it
I hope those short and simple explanations will be useful.
If you like what I do please consider supporting me on Patreon.