Project showcase
Viseesaw

Viseesaw © CC BY-SA

Viseesaw uses the figure of a seesaw, to show metaphorically the inequality of two physical, conceptual or social realities.

  • 1,462 views
  • 0 comments
  • 4 respects

Components and supplies

About this project

Viseesaw uses the figure of a seesaw, to show metaphorically the inequality of two physical, conceptual or social realities.

The swinging movement of the seesaw is done by a stepper motor which is controlled by MKR1000.

The inputs would come from two cases that could switch during the time:

Input Case 1

• Viseesaw would be placed in the middle of a room. Virtual division of the room in two spaces. The swing of the seesaw would represent how many people are in each side of a room.

1. A sensor in the door of the room would count how many people are inside. Other (two) sensors placed in the middle of the room would count how many visitors are crossing the middle of the room. This information would be sent to Genuino.

2. Every time there is a change on the distribution of the visitors in the room, the seesaw swing position would be updated.

Input case 2

• The swing of the seesaw would represent the inequality of two realities that someone would like to confront.

1. MKR1000 would process the information of each inequality from a database which is managed from an open public website accessed by internet.

This project pretends to be implemented in 3 parts.

Part I

At this stage of the project (part I) the movement of the seesaw is controlled at this way:

- MKR1000 reads a number value in a webpage as a Web client via WIFI.

- MKR1000 transform this value to the number of steps to be a applied to a stepper motor which moves the seesaw.

1 a) Construction of the seeasaw.

2D CAD design

Most of the parts were manufactured cutting 4mm thickness wood plates with a laser cutting machine.

Some parts are joined with wood glue to get 12 mm thickness. (Tip: in order to avoid movement and misalignment you can design the parts with rectangle holes and insert rectangle wood pins before fixing the 3 woods plates part with glue).

1 b) Motion System

Stepper motor - NEMA-17 size - 200 steps/rev, 12V 350mA

G260 mm GT2 Timing belt - 260 mm long

Aluminum GT2 Timing Pulley - 6mm Belt - 36 Tooth - 8mm Bore

Aluminum GT2 Timing Pulley - 6mm Belt - 20 Tooth - 5mm Bore

2x 608.ZZ bearing

D8 mm shaft

The long plate of the seesaw is relative light, but it is quite long, therefore it has moment inertia and can produce back lash.

1 c) Arduino + sketch

MKR1000 provides 3.3v digital I/O.

Adafruit mortor shield V2.3 can work with 3v and 5v digital I/O. By default it is 5v, and it is possible to changet to 3v with a drop of solder to bridge the corresponding 3v jumpers.

In this project I decided to keep de 5v digitar I/O of the motor shield in order to avoid welding, and I have used a 4 channel 2C level shifter to pullup 3v digital I/O from Arduino/Genuino MKR1000 to 5v I/O in the motor shield.

Arduino Ground is powering the 5v of the motor shield and also the 3v and 5v of the 2C level shifter. Same with the Ground.

MKR1000 SCL pin is connected after pulled up (5v) to the A5 pin in motor shield.

MKR1000 SDA pin is connected after pulled up (5v) to the A4 pin in motor shield.

The motor is powered from a external power supply 12v 1500mA connected to the motor shield.

1 d) Code

- MKR1000 reads an angle value in a webpage as a Web client. Library <SPI.h> <WiFi101.h>

Wifi connection.

The page we are reading is also containing headers which we have to clean. For that we need a mark which indicates when we have to read the angle value. As a mark I have a letter, e.g. "L".

e.g Webpage content:

L24K

"L" start to read, 24 degree angle to swing, "K" end to read.

- MKR1000 transform this value to the number of steps to be applied in the stepper motor shield in order to move the motor and the viseesaw. <Wire.h><Adafruit_MotorShield.h> and "utility/Adafruit_MS_PWMServoDriver.h"

Part II (coming soon)

Placed Viseesaw in the middle of a room. Depending how the people are distributed in each side of the room

In order to count how many people are in each side of the room some sensors will be placed in the entrance and middle of a room.

Ultrasounds distance sensors SR-04

In order to know if a person is going in or out, at each position will be necessary 2 sensor which allow to know direction.

Entrance: 1 point x 2 sensor

Middle room: 2 point x 2 sensor

Total: 6 sensors

Part (III) IOT & Azure

This project also pretend that Visesaaw can interact with a website as IoT.

We hope Microsoft can support this project and give more time to use Microsoft Azure as trial time expired.

Code

Viseesaw IArduino
/* This sketch has been programmed with the comabination of examples of 
 *  Adafruit assembled Motor Shield for Arduino v2 and Wifi Web Client
 *  31/3/2016
 */
/* 
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2 
---->	http://www.adafruit.com/products/1438
*/

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
int angle_web;
int angle;
int max_angle = 27;
float pulley_ratio = 0.5; // [shaft angle/motor_angle]   // (pulley 20 teeth (motor) - pullety 40 teeth (shaft)
int steps;
int motor_steps = 200;
float motor_ratio;   // [motor_angle/step] 
float total_ratio;   // [shaft_angle/step]
int angle_web_1;

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(motor_steps, 2);


/********************************************************************************
  Repeating Wifi Web Client

 This sketch connects to a a web server and makes a request
 using an Arduino Wifi shield.

 Circuit:
 * WiFi shield attached to pins SPI pins and pin 7

 created 23 April 2012
 modified 31 May 2012
 by Tom Igoe
 modified 13 Jan 2014
 by Federico Vanzati

 http://arduino.cc/en/Tutorial/WifiWebClientRepeating
 This code is in the public domain.
 */

#include <SPI.h>
#include <WiFi101.h>
 
char ssid[] = "";      //  your network SSID (name)
char pass[] = "";   // your network password
int keyIndex = 0;            // your network key Index number (needed only for WEP)
/////
int status = WL_IDLE_STATUS;

// Initialize the Wifi client library
WiFiClient client;

// server address:
char server[] = "www.danielportoles.com";
//IPAddress server(64,131,82,241);

unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 20L * 1000L; // delay between updates, in milliseconds
/********************************************************************************************************************** */

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Stepper test!");

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
  
  myMotor->setSpeed(6);  // 10 rpm   
  /* *************************************************************************************
   *  ***********************************************************************************
   */

   motor_ratio = 360 / (float) motor_steps;   // [motor_angle/step] 
   total_ratio = pulley_ratio * motor_ratio;    // [shaft_angle/step]

  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }
  // you're connected now, so print out the status:
  printWifiStatus();

   
}

void loop() {
  
  // if there's incoming data from the net connection.
  // send it out the serial port.  This is for debugging
  // purposes only:
  while (client.available()) {
    char c = client.read();
    if (c == 'L') {  // Start number
      c = client.read();
      angle_web_1 = c - '0';
      angle_web_1 = angle_web_1 * 10;
       c = client.read();
      int angle_web_2 = c - '0';
      angle_web = angle_web_1 + angle_web_2;
      if (angle_web > max_angle) { angle = max_angle;} else {angle = angle_web;}
      Serial.write("Angle read from website: ");
      Serial.print(angle_web);
      Serial.print("\t");
      Serial.write("Applied angle: ");
      Serial.print(angle);
      Serial.print("\n");
      steps = (int) ( angle/total_ratio );  // Convert number read in a webpage to number steps of stepmotor.
      Serial.write("Steps: ");
      Serial.println(steps);     
    }  
  }
    /* ************************************************************************************
   **************************************************************************************
  */
  delay (5000);
  Serial.println("Stepmotor Forward");
  myMotor->step(steps, FORWARD, MICROSTEP); //DOUBLE, INTERLEAVE, MICROSTEP
  delay (4000);
  Serial.println("Stepmotor Backward");
  myMotor->step(steps, BACKWARD, MICROSTEP); 
  delay (1000);
  //myMotor->release();

   /* ************************************************************************************
   **************************************************************************************
  */

  // if ten seconds have passed since your last connection,
  // then connect again and send data:
  if (millis() - lastConnectionTime > postingInterval) {
    httpRequest();
  }

  
}


// this method makes a HTTP connection to the server:
void httpRequest() {
  // close any connection before send a new request.
  // This will free the socket on the WiFi shield
  client.stop();

  // if there's a successful connection:
  if (client.connect(server, 80)) {
    //Serial.println("connecting...");
    // send the HTTP PUT request:
    client.println("GET /viseesaw/texto.php HTTP/1.1");
    client.println("Host: www.danielportoles.com");
    client.println("User-Agent: ArduinoWiFi/1.1");
    client.println("Connection: close");
    client.println();

    // note the time that the connection was made:
    lastConnectionTime = millis();
  }
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");
  }
}


void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.print(rssi);
  Serial.println(" dBm");
}


  

Comments

Author

Default
user20700377
  • 1 project
  • 0 followers

Additional contributors

  • This hamburg fab lab allows and promotes the use of their laser cut machine to the people who wants to create their own projects by Fabulous St. Pauli
  • Barbara provided her knowledge as lute maker for helping in the seesaw wood construction by Barbara Ferloni

Published on

April 1, 2016

Members who respect this project

DefaultCnyn noo6fluiip

and 2 others

See similar projects
you might like

Similar projects you might like

Multiple mode Environmental Sensor Deck with MKR1000

Project tutorial by Team ConsoleTeam

  • 11,340 views
  • 13 comments
  • 46 respects

IoT PCR: Low Cost DNA Replication Connected to the Internet.

Project showcase by Kemal Ficici

  • 8,256 views
  • 0 comments
  • 28 respects

Arduino MKR1000/Zero Neopixel Throwie

Project tutorial by Colin Russell-Conway

  • 3,763 views
  • 4 comments
  • 11 respects

Stylish IoT Neck Warmer Controlled from Mobile Browser

Project tutorial by Dr. Charif Mahmoudi

  • 3,142 views
  • 3 comments
  • 30 respects

Say Thanks to all Courteous Drivers

Project tutorial by Harold Pulcher (Microsoft MVP)

  • 11,631 views
  • 7 comments
  • 50 respects

Cardiac Monitoring System - EKG

Project showcase by Zorzonel Vlad

  • 10,431 views
  • 7 comments
  • 34 respects
Add projectSign up / Login