- 1 Makeblock XY-Plotter Robot Kit V2.0 (No Electronics). This include all mechanical parts, two step motors (control position of pen), 1 servo motor (control pen up/down) and four touch sensors (detect the top, bottom, left and right border reach).
- 1 PHPoC blue (Provide web interface and control two step motors via PHPoC Motor Controller)
- 2 PHPoC Step Motor Controller (control to two step motors to move the pen )
When a finger touches to the drawing area in webpage, the XY coordinate of touching point is sent to PHPoC. After scaling the coordinate, PHPoC will move two step motors to locate the pen to that coordinate. During moving period, PHPoC continuously send trajectory of the pen to web app, the web app draw the trajectory on the canvas.Wiring
- Stack two step motor controllers on PHPoC
- Connect to servo motor
- Connect to limit switches.
This project use two motors and two step motor controllers;
- One step motor and one step motor controller control left-right direction (X-axis). This step motor controller needs to connect to two limit switches attached on left and right side of XY-Plotter. Left-switch to SW#1, right-switch to SW#0
- One step motor and one step motor controller control up-down direction (Y-axis). This step motor controller needs to connect to two limit switches attached on top and bottom side of XY-Plotter. Bottom-switch to SW#1, top-switch to SW#0
Note that: we only use SW#0 and SW#1. We don't use SW#2 and SW#3 as in imageSource code
Main task (task0.php):
- Receiving the command from webpage and do task according to command.
- CMD_MOVE: move pen to a position by controlling two step motor
- CMD_PEN_UP: raise the pen by changing the angle of servo motor
- CMD_PEN_DOWN: lower the pen by changing the angle of servo motor
- Continuously read the current position of pen and send to webpage
Web interface (index.php)
- Providing the user interface
- Handling the user event and send command with coordinate to PHPoC
- Receiving the trajectory from PHPoC and draw it on webpage