The microprocessor:

For the microprocessor required in our project, we decided to use an 'arduino uno' module.



The advantages of using an arduino is that it is very easy to use. It doesn't require the knowledge of the assembler language, because arduino comes with a compiler that converts your code without any problems. Another advantage arduino offers is the vast amounts of user created libraries from which you can use example codes for all possible applications.

Coding of the arduino uno:



The program starts off with defining all the inputs, outputs and constants and initializing them (because the arduino board needs to be told which pins are going to be used).

In the main loop there are two possible working modes. The first consists of manual control in which you can control the robot with the joystick. In the second working mode the robot will sow seeds at the coordinates selected by the user in the GUI. The main loop will continue until all the desired spots are sowed and will then indicate that the program has finished by lighting all the led's on the pcb.

The main loop of the program consists of reading if the joystick has been used, positioning the robot arm in the required position (procedure plaats) and sowing the seed (procedure zaaien). Finally the current values for the variables are printed in the serial monitor to be able to track the progress of the program.



Procedure plaats:

This procedure starts by calculating the angles required for the positioning of the arm (see the mechanics tab on the website). Next is sending these angles to the servo motors. After sending these values, the arduino will read out the potentiometers on the servo motors for feedback and control the led's to show if the servo's are moving or not. A small delay is added to make sure the servo's have come to a complete standstill.

Procedure zaaien:

This procedure controls the smallest servo motor to plant a seed and then check the IR-sensor if the seed fell out or not. If the seed got planted, the program will move on, if it didn't, the arm will move rapidly from side to side to try and shake loose any seeds stuck in the mechanism. After three unsuccessful tries of planting the seed the user will be notified something is wrong with the mechanism or it ran out of seeds by letting a led light up.

The file containing all our microprocessor programming can be downloaded here:

Right click to download arduino file here