Sunteți pe pagina 1din 12

Washing Machine Implementation using a Picaxe Motor Controller

Leah Schottin, Tariq Chau, Hyun-Chan Jang


ELEC3204
Group 6
6 June 2018
1

1. Project Objective
The goal of this design project was to practically apply knowledge gained from lectures and
tutorials to design and build a DC drive system using a Picaxe microcontroller [1]. An H-bridge PCB
was provided to laboratory groups along with two 12 V 0.5 A DC motors [2]. The workload of this
project was broken down equally among group members, with each member leading a certain aspect
of the design. Leah managed hardware design, Tariq handled hardware assembly, and CJ handled
software design. Team members generally worked in parallel with one another to optimize
prototyping, while testing of the washing machine was completed together.

2. System Application and Description


The washing machine is a commonplace application of a power electronics drive system that
is controlled by a computer [1].​ ​In this case, the washing machine bucket and the clothes or water
within it act as the load of the drive system. The washing machine has six different cycles that the user
can choose including washing, cleaning, and spinning. Variations in motor speed and the direction of
rotation serve to differentiate between these cycles. There is one condition in which the motor speed
will remain constant with differing loads.

Figure 1.​ Implementation of washing machine using Picaxe microcontroller.

When the washing machine is switched on, the motor begins to rotate based on cycle setting
specified by the rotary switch. This, in turn, rotates a gear train and spins the cup.​ ​The washing
machine can be turned off at any time by the ON/OFF switch. When the load is varied, the washing
2

machine is able to maintain a constant speed using a negative feedback network. The shaft of the
control motor, which is connected to the gear train, is coupled with a second motor that acts as a
generator. When the control motor shaft rotates, a proportional voltage is produced by the sensing
motor. This voltage is then fed back to the Picaxe microcontroller, which reads the voltage level and
alters the output power to the control motor accordingly to maintain the current rotating speed.

3. Operational Requirements

There were two types of conditions under which the washing machine had to function, open
loop and closed loop. Open loop means that control signal is unaffected by the following outcome and
is held being at constant value. On the other hand, in the closed loop condition, there is an
introduction of error signal (e(t) = y(t) - r(t)) which is created by feeding the output of system into the
controller. The difference between them, e(t), is used to be amplified to the extent that it will control
the output to its desired value [1]. It was required that the washing machine machine mimic actual
washing, cleaning, and spinning cycles with varying motor speeds. Furthermore, the project
assignment stated that the motor should be able to rotate in either direction with different speeds,
which could be performed in the open loop condition. One closed loop, negative feedback condition
was required, in which the motor was to spin at the same speed despite variations in the washing
machine load [1]. This would simulate adding more clothes or water to the washing machine bucket.
Finally, students were encouraged to include further peripherals to their designs such as switches or
push buttons. For this washing machine implementation, an ON/OFF switch was added, along with a
rotary switch for choosing the desired cycle type. The rotary switch allows users to choose between
six different cycles, all of which are detailed in Figure 2 below.

Figure 2.​ Table of washing machine scenarios and the corresponding cycle types.
Switch Number Cycle Direction Duty Cycle Loop

1 washing clockwise 80/20 open

2 cleaning clockwise 90/10 open

3 spinning clockwise 100/0 open

4 cleaning clockwise 90/10 open

5 spinning clockwise 100/0 open

6 ultra wash anticlockwise 80/20 closed

4. Hardware Design
The hardware design for this implementation of a washing machine went through two
iterations, both beginning with the block diagram shown below in Figure 3. The input to the washing
machine input was chosen to be a switch on. The Picaxe microcontroller would then output a specified
PWM signal to the four quadrant power converter used to for motor control. In this case, this power
converter was the provided H-bridge. The H-bridge was powered by 12 V, whereas the Picaxe
microcontroller was powered by 5 V. The PWM from the Picaxe turned on a diagonal pair of
transistors in the H-bridge, the voltage output of which was connected to the control motor. A rubber
3

collar linked the shaft of the control motor to that of the sensing motor. Therefore, when the control
motor rotated, it turned the shaft of the sensing motor. The sensing motor then generated a voltage
which was fed back to the Picaxe. This created a system of negative feedback, where the voltage from
the sensing motor was read by the Picaxe and used to control the speed of the control motor. The shaft
of the control motor was also connected to a gear box. There was one small gear around the shaft of
the control motor, which was meshed with a larger gear used to turn the post on which the plastic cup,
emulating the washing machine bucket, was glued. The vertically aligned motors, as well as the
gearbox can be seen in Figure 5. This plastic cup could be filled or emptied as desired to alter the load
on the device. Furthermore, as can be seen in Figure 1, a rotary switch was also placed on the front of
the washing machine to enable users to select their speed and direction setting. To make the final
build of the washing machine more presentable and cleaner looking, the wire connections for the
switches, printed circuit board, and Picaxe were all neatly contained in a black box. This can also be
seen in Figure 1.

Figure 3.​ Block diagram of washing machine drive system.

The initial design of the washing machine was slightly different than the final build of the
device. First, rather than switches, the input to the machine was chosen to be button presses. There
was to be one button for turning ON/OFF and another for selecting the cycle type. For example, two
consecutive presses of the cycle button would choose the cleaning option with a duty cycle of 90/10.
To avoid having to implement software debouncing for these buttons, switches were used in the final
implementation. Additionally, a gear belt was originally chosen to be used to turn the plastic cup.
However, the possibility of the belt slipping increased the chance of failure for the device, so a
gearbox was used despite being more costly. A pressure sensor was removed from the washing
machine design because the load which the plastic cup could hold was too light to be meaningfully
measured. Finally, the printed circuit board containing the H-bridge was not mounted to the side of
the washing machine to make it easier to isolate different parts of the machine for testing and
debugging. The initial design for the washing machine is illustrated below in Figure 4.
4

Figure 4. ​Initial design of washing machine.

Figure 5.​ Feedback system and gear box for washing machine. Plastic cup was glued to red paddle
seen on top right, next to control motor.
5

The Picaxe was connected to the printed circuit board by the IN1 and IN2 terminals, both of
which supply a PWM output. The 5 V and GND terminals of the Picaxe were also connected to the
printed circuit board. The rotary switch is connected to the Picaxe by terminals OUT1 to OUT5 for
the open loop cycle options and to IN0 and ground for the closed loop condition. The IN0 and ground
connections must only be connected when feedback is required for the washing machine to function
properly. All of these connections can be seen in Figure 6. Furthermore, the LEDs that are present on
the Picaxe and the H-bridge indicate that the boards are properly powered. The H-bridge board also
has four banana plug connectors. As shown in Figure 6, the top two banana plugs are V​in​ = 12 V and
ground, used for powering the board. The bottom two banana plugs are V​out​ and ground, used to
power the control motor.

Figure 6.​ Washing machine PCB with picaxe connection.


6

Figure 7.​ Final design of washing machine

The final design for the washing machine, including a description of the rotary switch and the
corresponding cycles on each of its six switches is illustrated in Figure 7. This final design meets all
design requirements, specifically motor speed control under open loop conditions, the ability to rotate
both clockwise and anticlockwise, as well as constant speed control when varying loads under a
closed loop condition. The closed loop condition is the only one which utilizes feedback.

5. Software Design
The code structure
​Code structure for this project is fairly simple, it contains two loops: main and closed loop. As the
project does not require overly sophisticated system, it was sufficient enough to use few if statements
on the main loop to change speeds. Main loop identifies the options(input) and implements the
open-loop output to the system while if the closed loop operation is chosen, the main loop jumps to
closed loop subroutine. Closed loop system will send the target speed to the system and read the
actual speed on the feedback motor. By comparing the value of feedback to the target speed, the
program will adjust the speed by the smallest amount possible (=1) for its smooth feedback transition
to reach the target speed rather than having a huge gain and overshooting due to that gain. The ADC
value from the feedback motor had to be checked by multimeter in order to compare with our
calculated value of ADC. From testing and gaining those values, we could set the right ADC value
that fits in the acceptable range and can be safely used in closed loop operation.
7

Integration of the software and hardware


Switching by 6 way rotator (input) enables us which speed/direction and mode the machine should be
operating on. The on/off switch is the emergency stop button which shuts down the operation
completely if used.

Figure 8​. Flow chart of the software


8

Please note that, while operating any modes, the machine can be shut down by its emergency
ON/OFF switch.

6. System Performance and Validation


Once the hardware and software portions of this implementation of a washing machine were
completed separately, integration began. The open loop portions of the code were tested and validated
using the physical device first. The code worked as expected, with five different open loop settings
able to be specified using the rotary switch. These five options run at three different duty cycles:
80/20, 90/10, and 100/0. The 90/10 and 100/0 options are able to rotate both clockwise and
anticlockwise. Proper functioning of these open loop settings was confirmed by simply running the
code and checking that the washing machine bucket assumed the anticipated speed once the rotary
switch was turned. It was also checked that the washing machine spun at the proper speed whether the
rotary switch was shifted up from the lowest setting or down from the highest setting. It was
discovered through testing that there is a slight delay in response time between when the rotary switch
is moved and when the speed of the washing machine changes. However, this response time was
deemed to be inherent based on the structure of the Picaxe code.
Next, the closed loop code was tested. There is only one closed loop setting on the washing
machine, with a duty cycle of 80/20 and a direction of anticlockwise. This setting uses feedback from
the sensing motor to maintain a constant washing machine speed despite changes in the bucket load.
This is also the highest setting on the rotary switch. Closed loop functioning was tested by uploading
the code and either filling or emptying the cup as the control motor spun. Most noticeably, if the
feedback network or the Picaxe code was not working, the speed of the washing machine would have
decreased when the cup was full. However, as there were no observed changes in the speed of the
device, it was confirmed that this portion of code worked properly.
The greatest issue we experienced with the washing machine during testing was that the
rubber collar which was used to connect the shaft of the control motor to the adjacent shaft of the
sensing motor would tear after extended use. We had to replace this rubber collar twice during testing.
It was easy to pinpoint this problem, however, because the smell of burning rubber in the air around
our lab station made it apparent that the collar had torn. When the rubber collar is disconnected, there
is no feedback and the closed loop setting of the washing machine ceases to function. Therefore, it is
necessary to monitor wear on this piece of the device and turn off the washing machine when it is not
in use. Overall, both the hardware and software of the washing machine function successfully and
meet the design requirements.

7. References
[1] ‘Project Note for ELEC3204/3904 - Power Electronics and Applications’ 20 May 2018
https://canvas.sydney.edu.au/courses/2530/pages/project-instruction-and-report-requirement?module_
item_id=125437
[2] ‘Motor Datasheet’ 20 May 2018
https://canvas.sydney.edu.au/courses/2530/pages/project-instruction-and-report-requirement?module_
item_id=125437
[3] ‘Introduction of Picaxe 14M2’ 10 April 2018
https://canvas.sydney.edu.au/courses/2530/pages/project-instruction-and-report-requirement?module_
item_id=125437
9

8. Appendix 1 - Code
;; Program : Washing Machine
;; Progamed by : GROUP W6
;; Date : 23/05/18
;; Purpose: Mimic the motion of washing machine
;; both in open loop and closed loop systems
;; Comment : pause might be needed between switching modes.
;;
setfreq M32
;;let dirsC = %11100110 ;; Port C pin 0,3,4 to inputs

;; INIT AND DECL


;; below pins all used as inputs (switch)
symbol wash = pinB.1
symbol clean = pinB.2
symbol spin = pinB.3
symbol opp_clean = pinB.4
symbol opp_spin = pinB.5

symbol closed_loop = pinC.4

symbol targetDuty = b0 ;; 80/20 D.C


b0 = 192

;ymbol subroutine_closed_loop

main:

; hpwm 1,0,0,79,b4

; wash 80/20
IF wash = 1 AND clean = 0 AND spin = 0 AND opp_clean = 0 AND closed_loop =0 AND
opp_spin = 0 THEN
hpwm 1,0,0,79,256
b4= 256
goto main

; clean 90/10
ELSE IF wash = 0 AND clean = 1 AND spin = 0 AND opp_clean = 0 AND closed_loop= 0
AND opp_spin = 0 THEN
hpwm 1,0,0,79,288
b4= 288
goto main
10

; spin 100/0
ELSE IF wash = 0 AND clean = 0 AND spin = 1 AND opp_clean = 0 AND closed_loop= 0
AND opp_spin = 0 THEN
hpwm 1,0,0,79,320
b4= 320
goto main

; opp_clean 10/90 ;; DEBUG HERE 1 , not starting motor


ELSE IF wash = 0 AND clean = 0 AND spin = 0 AND opp_clean = 1 AND closed_loop =0
AND opp_spin = 0 THEN
hpwm 1,0,0,79,32
b4= 32
goto main

; opp_spin 0/100
ELSE IF wash = 0 AND clean = 0 AND spin = 0 AND opp_clean = 0 AND closed_loop= 0
AND opp_spin = 1 THEN
hpwm 1,0,0,79,0
b4= 0
goto main

; go to closed loop 60% DC


ELSE IF wash = 0 AND clean = 0 AND spin = 0 AND opp_clean = 0 AND closed_loop= 1
AND opp_spin = 0 THEN

goto subroutine_closed_loop

ENDIF

goto main

subroutine_closed_loop:
;; wrong subroutine endpoint
11

hpwm 1,0,0,79, b0
readadc C.0, b1
debug

;; 60% DC

;; acceptable range of targetDuty


IF b1 > 110 THEN
b0 = b0 - 1
goto main

ELSEIF b1 < 100 THEN


b0 = b0 +1
goto main
ENDIF

goto main

S-ar putea să vă placă și