Week seventeen: Machine design
For the automation of this machine Yvonne Lomas Montaudon designed a circuitboard for controlling the motors, sadly because of manufacturing problems the board was unusable.
For this, we used a local Fabhouse circuit, it was designed in Fablab Puebla and manufactured by a local provider called Ryspee.
The charateristics of the circuitboard are the following:
Components:
This is the schematic for the board.
Master
Slave
#include <Servo.h>
#include <Wire.h>
char code='x';
int cmd=0;
Servo act;
void setup() {
// put your setup code here, to run once:
act.attach(9);
Serial.begin(9600);
Wire.begin();
}
void loop() {
// put your main code here, to run repeatedly:
if(Serial.available())
{
code=Serial.read();
}
if(code=='0')
{
Wire.beginTransmission(0x1);
Wire.write(3);
Wire.endTransmission();
delay(1);
Wire.beginTransmission(0x2);
Wire.write(3);
Wire.endTransmission();
delay(1);
}
if(code=='1')
{
Wire.beginTransmission(0x1);
Wire.write(1);
Wire.endTransmission();
delay(1);
}
if(code=='2')
{
Wire.beginTransmission(0x1);
Wire.write(2);
Wire.endTransmission();
delay(1);
}
if(code=='3')
{
Wire.beginTransmission(0x2);
Wire.write(1);
Wire.endTransmission();
delay(1);
}
if(code=='4')
{
Wire.beginTransmission(0x2);
Wire.write(2);
Wire.endTransmission();
delay(1);
}
if(code=='5')
{
act.write(45);
}
if(code=='6')
{
act.write(55);
}
}
#include "TinyWireS.h" // wrapper class for I2C slave routines
#define i2c_addr 0x2
int stp=1, dir=7, ms1=2, ms2=3, slp=0, ena=10;\
byte rcvd=0;
int i=0;
void setup()
{
pinMode(stp, OUTPUT);
pinMode(dir, OUTPUT);
pinMode(ms1, OUTPUT);
pinMode(ms2, OUTPUT);
pinMode(slp, OUTPUT);
pinMode(ena, OUTPUT);
digitalWrite(ms1, LOW);digitalWrite(ms2, LOW);
digitalWrite(ena, LOW);digitalWrite(slp, HIGH);
digitalWrite(dir,1);
TinyWireS.begin(i2c_addr);
}
void loop()
{
if(TinyWireS.available())
{
rcvd=TinyWireS.receive();
if(rcvd==1)
{
digitalWrite(dir,1);
digitalWrite(stp,1);
delay(10);
digitalWrite(stp,0);
delay(10);
}
if(rcvd==2)
{
digitalWrite(dir,0);
digitalWrite(stp,1);
delay(10);
digitalWrite(stp,0);
delay(10);
}
if(rcvd==3)
{
digitalWrite(dir,1);
for(i=0; i++; i<200)
{
digitalWrite(stp,1);
delay(10);
digitalWrite(stp,0);
delay(10);
digitalWrite(stp,1);
delay(10);
}
}
if(rcvd==4)
{
digitalWrite(dir,0);
for(i=0; i++; i<200)
{
digitalWrite(stp,1);
delay(10);
digitalWrite(stp,0);
delay(10);
digitalWrite(stp,1);
delay(10);
}
}
}
}
This is the link to the group project.
http://fab.academany.org/2018/labs/fablabpuebla/students/yvonne-lomasmontaudon/team.html#teamw