This page details each part of my final project which is a parallel water dispenser with
human interation around the machine. The main reason to create was to show some attractive in digital fabrication,
it had a part of social game to meet people in a party. The game was to find people with the same colour ticket, after that
they moved around the machine and put their hands over IR sensors on the machine. The project will details in the three next sections:
structure machine, electronics and programming
In this section we describe the 3D printing that we created. Three things designed here: head of machine , a valve and box to put the circuits. The first one was created to put leds and IR sensor, they are able when the machine is able to dispense or start the connection. A head complementary was a MDF desgin to fix with the supports. This design shows in the next images and can download the CAD files
The valve was based on a simple idea of cow udder, which has more than two udders. But we considered a single flow input and multiple flow output. In the 3D printing the elements sent with 60% fill inside, this measure took to not filter water. If only joint the elements with nuts, the valve will filter water. So we cut foami with the form of valve, it puts in the middle of two elements to press. You can donwload the CAD files
My structure is cool in shape but have limitation as space to put circuit. So I considered only dispensing four glasses and two of them, they will use the space to put a box which close circuits. This design shows in the next images and can download the CAD files
In this section we describe electronics PCB that machine uses. The elements have made IR sensor, H-bridge single,
and boards expansion. Additionally, we produced a boad which has ATMega328p as microcontroller
. It can connect five IR sensors, each one will has 2x3 pin header which two rows are power supply(Vcc and GND) and
digital output.This board has a pin header 2x2 to connect h-bridge with power supply. Also, it has connected tree
pins(13,12,1) with 2x3 headers which can connect with other fabduino through a pin and two pins to interact with
leds.
The image belong here represents the schematic electronic of my board. In the right side shows all layout PCB. These designs based on Fabduino 0.2v. So we program this board
with same Fabduino parameters on Arduino IDE:
Our board after milling the PCB.
Soldering ATMega328p in the board.
Finally, we tested our board with AVRisp2 to burn bootloader and upload new sketches on Arduino.
int main(void) { // main static unsigned char count; static uint16_t on,off; float fliter = 0, eps= 0.9 , amp=25.0; // set clock divider to /1 CLKPR = (1 << CLKPCE); CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0) // initialize output pins set(serial_port, serial_pin_out); output(serial_direction, serial_pin_out); set(led_port, led_pin); output(led_direction, led_pin); // init A/D ADMUX = (0 << REFS2) | (0 << REFS1) | (0 << REFS0) // Vcc ref | (0 << ADLAR) // right adjust | (0 << MUX3) | (0 << MUX2) | (1 << MUX1) | (0 << MUX0); // ADC2 ADCSRA = (1 << ADEN) // enable | (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0); // prescaler /128 // main loop while (1) { // accumulate on = 0; off = 0; for (count = 0; count < nloop; ++count) { // LED off set(led_port, led_pin); // initiate conversion ADCSRA |= (1 << ADSC); // wait for completion while (ADCSRA & (1 << ADSC)) ; // save result off += ADC; // LED on clear(led_port, led_pin); // initiate conversion ADCSRA |= (1 << ADSC); // wait for completion while (ADCSRA & (1 << ADSC)) ; // save result on += ADC; } on = on/nloop; off = off/nloop; //conversion filter = eps*amp*(float(on-off)) if(filter > 350) { put_char(&serial_port, serial_pin_out, 255); } else { put_char(&serial_port, serial_pin_out, 0); } char_delay(); } }
The right image shows the hardware architecture which help to program the machine. The first fabduino is connected to expansion board where can plug in IR sensors, leds , H-bridge and one plug in to listen activation digital signal from fabduino 2. It connects to second expansion board plug inbluetooth. The idea is the app connect through bluetooth, and after 15 seconds the machine wait to sense people around it. When programming of this machine has three programs: android app, fabduino1 and fabduino2. The android app is the same that the interface and application programming . In the next subsection detail the source code for fabduino1 and fabduino2.
int re; int activation; void setup() { // put your setup code here, to run once: DDRD = B00001111; Serial.begin(9600); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, INPUT); pinMode(11, OUTPUT); pinMode(12,OUTPUT); pinMode(13,OUTPUT); digitalWrite(11, LOW); digitalWrite(12, LOW); } void loop() { // put your main code here, to run repeatedly: activation = digitalRead(10); Serial.println("Activation: "); Serial.println(activation); digitalWrite(13, activation); if(activation == HIGH){ re = PIND; re = re & B11110000; Serial.println(re); if(re == 0) //when all IR sensore will be activing by people { Serial.println("machine is activing"); //Turn on the bomb water digitalWrite(8, HIGH); digitalWrite(9, LOW); //turn on led 11 digitalWrite(11, HIGH); for(int i=0; i < 10; i++){ //blink the led 12 digitalWrite(12, HIGH); delay(500); digitalWrite(12, LOW); delay(500); } //turn of the bomb digitalWrite(9,LOW); digitalWrite(8, LOW); //you can drink and wait to take the glass for 10 seconds digitalWrite(12, HIGH); delay(10000); } else { digitalWrite(11, HIGH); delay(500); digitalWrite(11, LOW); delay(500); } } digitalWrite(11, LOW); digitalWrite(12, LOW); }
#include <SoftwareSerial.h> #include "tools.h" SoftwareSerial BTserial(8, 2); // RX | TX // Connect the HC-05 TX to Arduino pin 8 RX. // Connect the HC-05 RX to Arduino pin 2 TX through a voltage divider. // Connect the HC-05 STATE pin to Arduino pin 3. char c = ' '; // BTconnected will = false when not connected and true when connected boolean BTconnected = false; // connect the STATE pin to Arduino pin D4 const byte BTpin = 3; //pin activation const byte ACTpin = 4; //pin led activation const byte led = 13; void setup() { // put your setup code here, to run once: pinMode(BTpin, INPUT); pinMode(ACTpin, OUTPUT); pinMode(led, OUTPUT); digitalWrite(13, LOW); Serial.begin(9600); Serial.println("Fabduino is running"); Serial.println("Connect bluetooth to android device"); digitalWrite(ACTpin, LOW); // wait until the HC-05 has made a connection while (!BTconnected) { if ( digitalRead(BTpin)==HIGH) { BTconnected = true;}; } Serial.println("HC-05 is now connected"); Serial.println(""); //start the bluetooth module BTserial.begin(9600); } void loop() { // put your main code here, to run repeatedly: // Keep reading from the HC-05 and send to Arduino Serial Monitor if (BTserial.available()) { c = BTserial.read(); Serial.write(c); if(c == 'A') { Serial.println("Activate machine"); digitalWrite(ACTpin, HIGH); digitalWrite(led, HIGH); delay(18000); digitalWrite(ACTpin, LOW); digitalWrite(led, LOW); //BTserial.write('O'); } } // Keep reading from Arduino Serial Monitor input field and send to HC-05 if (Serial.available()) { c = Serial.read(); BTserial.write(c); } }
The materials to complete this project are:
This work is licensed under a Creative CommonsAttribution-NoDerivatives 4.0 International License.