27/04/2016
Add an output device to a microcontroller board you've designed and program it to do something.
For the assignment I decided to design the first prototype of the controller board that I will use for my final project. So I organized the two exercise, input and output devices together.
To control the pellet extruder I will need a ceramic heater cartridge in order to heat the noozle, a thermocouple to control the temperature, a thermistor or a temperature sensor to mesure the ambient temperature, a DC geared motor for the extrusion and a solenoid valve to cool the extruded material.
Board: on the board I have used a couple of through hole components, and soldered bending the feet.
The ISP connector have 10 pins becouse I have added the RX an TX in order to allow the serial communication, that will used to communicate with the robot, but to make easier the wiring I have installed an RJ45 connector too. The robot core and the extruder control board will be 7m distant.
Milling: milling the board was pretty tricky, because the 328P-AU have a very tiny footprint, the pads are very close each oder (only 0,25mm). To mill the board I have used the same process described in the electronics production module.
//define all the output pins
#define R1 10
#define R2 9
#define R3 6
#define MOT 11
#define COMP 5
void setup() {
//initialize the serial port
Serial.begin(9600);
//set the pins as an output
pinMode(R1, OUTPUT);
pinMode(R2, OUTPUT);
pinMode(R3, OUTPUT);
pinMode(MOT, OUTPUT);
pinMode(COMP, OUTPUT);
}
void loop() {
//turn on the output
//and set up the motor speed
analogWrite(MOT, 160);
digitalWrite(R1, HIGH);
digitalWrite(R2, HIGH);
digitalWrite(R3, HIGH);
digitalWrite(COMP, HIGH);
//wait 5 second
delay(5000);
//turn off the output
//and slowdown the motor speed
analogWrite(MOT, 40);
digitalWrite(R1, LOW);
digitalWrite(R2, LOW);
digitalWrite(R3, LOW);
digitalWrite(COMP, LOW);
delay(5000);
}
The code: this sketch will test all the output of the board, so will turn on and off the motor, all the trhee Ceramic heater cartridge and the air.
Upload the code: same process described above.
The code has worked well and concluding that I have tested all the components, that are working all. Anyway I'm going to implement some features in a second version of the board, that will installed on the final project.
Board: I decided to usa an ATMEGA328P-AU insted of using the Attiny44, because I will need a lot of PWM ports and the hardware serial, in order to allow the comunication between the robot and the control board.
To control the nozzle temperature I will use a thermocouple to allow a very accurate measurement; so I have installed the AD594 in order to read the data from the thermocouple type J.
To heating the nozzle I use 3 Ceramic heater cartridge, so I will need 3 mosfet to allow the control of the heating and other two to control the DC geared motr and the Solenoid valve.