This week I spend most of the time on programming. There are three main parts that have been done.
1) Improve Servo control by using analogWrite() function. This function will send PWM pulse continuously to the Servo. The frequency
of the PWM will be set by setAnalogWriteFrequency (PIN, PERIOD in ms ). We use 22 to get the most nearly 50 Hz. (By experiment and measure by scope)
Servo control is programmed in servoWrite(angle) function. The Angle of the Servo will be mapped to duty cycle by using map function between 0 - 180 degrees
and MIN/MAX of Duty cycle.
2) Program Control DC motor. Firstly, install the library TLE94112 for Arduino. I use example control2Motors as a reference. To get most of the current for DC motor,
I use HB1, HB2 for crusher_motor’s highside and HB3, HB4 for crusher_motor’s lowside. For another motor, I use HB9, HB10 for stir_motor’s highside and HB11, HB12 for stir_motor’s lowside.
I tested it with small motor and it works fine. But after I changed to bigger motor. The motor cannot start. The current drive should be enough because I join two outputs together which mean can
drive up to 1.8 amp. Then I tried to change command from start to rampSpeed command and it works fine. I still don’t know the reason. Maybe start up gradually reduce current at the startup.
3) Implement the Auto program, this program will automatically start from crush_motor to release EM from valve and start stirring motor at a specific of time.
From the experiment, I redesign that the start/stop button should be separate from the knob. This will reduce confusion and more easy to control start/stop anytime, because we can use interrupt
for start/stop button. At this moment, I still not finished implement start/stop yet.
I would like to show Video here. But I think it will be better if I show when all is finished.
Next I will concentrate on the program and start to build the machine as the meat grinder had arrived and the structure for the machine had been set up.
For source code go to https://github.com/wtos03/WasteFoodMgmt. Please note source code is not finalize and there is still a lot of testing command and it may change often.