Week 11's assignment
Our other instructor, Matthieu, suggested us that it would be a good idea to build our own Arduino board, a "fabDuino", which would then allow us to test and use as many inputs and outputs as we want. It would then be very usefull for the weeks to come and of course for our final project. So this is what I will try to do.
These are the settings used in the Fabmodule, with a 1/64 end mill (0.39mm) :
And here is the milled PCB. This is actually the first PCB that has been milled with the new Roland Monofab we recieved recently, which is a great improvement and will be much easier for us in the future :
And my Satchakit once all the components soldered :
Once the circuit ready, I juste have to use my original Arduino board to burn the Satchakit, because we still don't have a working ISP at the lab...
#define trigPin 13
#define echoPin 12
#define buzzer 11
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance < 5) {
digitalWrite(buzzer ,HIGH);
}
else {
digitalWrite(buzzer ,LOW);
}
}
Week11 - Basic code from Thomas Feminier on Vimeo.
tone function and added the serial communication.
#define trigPin 13
#define echoPin 12
#define buzzer 11
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer, OUTPUT);
}
void loop() {
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
Serial.println(distance);
//read the distance value. If <5cm, the piezo will produce a tone at 262mHz
if (distance <5) {
tone(buzzer,262);
}
//stop the tone function on the specified pin when distance is higher than 5cm
else {
noTone(buzzer);
}
}
Week11 - Code V2 from Thomas Feminier on Vimeo.
Week11 - Data reading from Thomas Feminier on Vimeo.
Serial port;
float brightness = 0;
void setup()
{
size(500,500);
port = new Serial(this,"/dev/cu.usbmodem1411",9600);
port.bufferUntil('\n');
}
void draw()
{
background((255-brightness*51),0,0); /** I want the screen to remain black until I get close to the sensor, so I use -255.
* The alarm starts at 5cm, so I multiply by 51 to get 255
*
*/
}
void serialEvent (Serial port)
{
brightness = float(port.readStringUntil('\n'));
}
Week11 - Processing from Thomas Feminier on Vimeo.