Contact:

E-mail: franco.robredo@gmail.com

 

Franco Robredo Bretón

Mechanical Engineer

 

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:

 

  • Base material FR-4TG130 in two layers
  • PCB dimensions Width: 1.6 mm
  • Red soldermask with white legends
  • Hasl finish
  • 2 ounces of copper
  • 6000 spaced
  • Minimum drill of 24000
  • microcontroller A4982
  • 45x56 mm

Components:

 

  • 2 3x1 pinheaders.
  • 1 3x2 pinheaders.
  • ATtiny84.
  • 8 20kOhm resistors (R1-R7, R12).
  • 2 1Ohm resistors (R8 and R9).
  • 2 1kOhm resistors (R10 and R11).
  • 5 Capacitors.
  • An LM3940 voltage regulator for 5v.
  • A TSSOP-24 Multiplexer Switch ICs.
  • 4 Screw terminals.

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);

       }

    }

  }

}