dmirpuri

Test

 

Putting everything together and testing it was the most time consuming aspect of the project. This is the stage where all issues started popping one after the other.

 

Testing & Debugging

 

I received the EasyDriver component with a right angle male headers. I could not plug this into the breadboard. So I desoldered the headers and then soldered the regular straight male headers back to the component. I was worried the component would get damaged, because the copper circle started coming off while desoldering, but it worked out fine.

20160407_195514 20160407_221056

 

 

Testing one of the stepper motor to run back and forth

 

 

Experimenting with the Pixy camera to turn on LEDs based on movement (Left and Right)

 

Putting the whole system together and testing how high the camera should be in place to cover the area of the tank

20160508_233450

 

 

Testing the stepper motors smoothness

 

 

Experimenting with a few drops of ferrofluid in the tank

 

 

Experiments with Ferrofluid and Building the Rails

 

 

Electromagnets

Issues with electromagnets not having enough pull intensity. Bought a few different electromagnet solenoids from Amazon and all but one was not working as described in the data sheet. The reason I wanted to use an electric magnet was because I wanted the ability to turn on and off, which would let the ferrofluid convert from liquid to spikes. This transition itself would bring out the artistic aspect of the project.

Screen Shot 2016-05-22 at 2.21.33 AM Screen Shot 2016-05-22 at 2.21.50 AM Screen Shot 2016-05-22 at 2.22.09 AM

Screen Shot 2016-05-22 at 2.22.17 AM

 

 

 

The Grove electromagnet by Seeedstudio was the one that had a decent pull intensity. However I could  not use this because it was not creating the spikes a regular Neodymium magnet would. And this was important to bring the artistic aspect of the ferrofluid.

 

 

 

 

 

 

 

 Back to Process

 

 

 

 

 

 

Code

 

Here I will be explaining the Pixy camera vision sensor along with the PixyMon software, wiring the stepper motor drivers, and coding the Arduino to read the data from the Pixy and map it to run the stepper motors. I used an Arduino UNO, 2 NEMA 17 Stepper Motors, and 2 EasyDrivers by Sparkfun.

 

Pixy CMUCam5

Pixy is a camera vision sensor and started out as a kickstarter product. More info here.

 

pixy-cmucam5

  • The Pixy camera can process upto 50 frames per second.
  • Since image sensors output lots of data, the Pixy pairs a powerful dedicated processor with the image sensor and sends only useful information to the microprocessor, which makes it have plenty of processing power available for other tasks.
  • Connects to Arduino, Raspberry Pi, Beaglebone and supports C/C++ and Python.
  • Pixy uses a color-based filtering algorithm to detect objects. It calculates the color (hue) and saturation of each RGB pixel from the image sensor and uses these as the primary filtering parameters. Pixy’s filtering algorithm is robust when it comes to lighting and exposure changes.

 

First I downloaded the Pixymon software, firmware, and Arduino library. If a new firmware is available, the pixy needs to be updated. To update the firmware,

  • Open the Pixymon software,
  • Press and hold the white button located on the top of the Pixy while plugging in USB.
  • After plugging in, let go.
  • Pixy programming state detected.
  • A dialog box will appear, select the firmware.hex file downloaded earlier.
  • All done!!

 

Next step is teaching the Pixy to track an object. Pixy can learn seven color signatures, numbered 1-7. Color signature 1 is the default signature. To teach Pixy the other signatures (2-7) requires a simple button pressing sequence.

  • Press and hold the white button and release when the LED turns red (first signature). Signature 1 – 7 LED color:
  1. Red
  2. Orange
  3. Yellow
  4. Green
  5. Cyan
  6. Blue
  7. Violet
  • Bring the object (hue) in front of the camera.
  • When the grid is perfect, press and release the white button once.
  • The object is then locked in place.

 

PixyCam Arduino

 

Then hooking the Pixy with Arduino is very simple.

  • Connect the 10pin to 6pin cable from the Pixy to the Arduino.
  • Import the Pixy library to Arduino.
  • Open example code and upload.

 

Screen Shot 2016-05-18 at 3.06.16 AM serial_window

 

So for my project, I 3D modeled a ring and printed with a bright orange PLA filament. This is for the user to wear when waving their hand on top of the tank filled with ferrofluid. The Pixy will track this ring because of its color and send information to the Arduino.

Screen Shot 2016-05-21 at 8.47.53 PM

 

 

Stepper Motor & EasyDriver

 

Stepper motors are perfect for automation or any time you need a motor to turn to a specific point, at a specific speed, in a specific direction.

easydriver

 

The EasyDriver does something called micro stepping. It breaks down that minimum step into smaller micro steps (in this case 8 micro steps per step). Microstepping allows for smoother and more accurate control, but that means that your 200 step stepper, connected to the EasyDriver needs 1600 ( 200 * 8 ) steps to make a full rotation. More info on the EasyDriver here.

 

 

Hooking it up with the Arduino (schematic below), I used a 12V 1A power adapter to run both motors.

 

2stepperMotorWiring

 

The Arduino code to run the stepper motors is pretty simple. It sets up pin 8 and 9 as outputs. It sets them both low to begin with. Then in the main loop, it simply toggles pin 9 high and low, waiting 1ms between toggles. I used pin 9 as the STEP control and pin 8 as the DIRECTION control to the Easy Driver.

 

void setup() {            
 pinMode(8, OUTPUT);
 pinMode(9, OUTPUT);
 digitalWrite(8, LOW);
 digitalWrite(9, LOW);
}
void loop() {
 digitalWrite(9, HIGH);
 delay(1);      
 digitalWrite(9, LOW);
 delay(1);      
}

 

Then combining these two (Pixy and stepper motor) required some algorithm. Here is a working code I worked on for this project. I must say that it is not accurate, but it fairly works. You can see some of the videos on the RESULTS and TEST page.

I wrote some functions to run the motors in different directions and applied it to the data received from the Pixy.

 

#include <SPI.h>
#include <Pixy.h>

// This is the main Pixy object
Pixy pixy;

int dirA = 8; //x-axis
int stepA = 9; //pwm
int dirB = 7; //y-axis
int stepB = 6; //pwm

int new_posX = pixy.blocks[0].x; //default
int old_posX = new_posX;
int cur_posX = 0;
int loopX = 0;
bool change_posX = false;

int new_posY = pixy.blocks[0].y; //default
int old_posY = new_posY;
int cur_posY = 0;
int loopY = 0;
bool change_posY = false;

void setup() {
pinMode(dirA, OUTPUT);
pinMode(stepA, OUTPUT);
pinMode(dirB, OUTPUT);
pinMode(stepB, OUTPUT);
digitalWrite(dirA, LOW);
digitalWrite(stepA, LOW);
digitalWrite(dirB, LOW);
digitalWrite(stepB, LOW);

pixy.init(); //starts the Pixy
}

void loop()
{
static int i = 0;
int j;
uint16_t blocks;

// grab blocks!
blocks = pixy.getBlocks();

if (blocks) //if blocks are detected
{
i++;
if (i % 1 == 0) //this prints data every frame
{
for (j = 0; j < blocks; j++)
{
old_posX = new_posX;
new_posX = pixy.blocks[0].x;
cur_posX = new_posX – old_posX;
loopX = abs(cur_posX * 8);

old_posY = new_posY;
new_posY = pixy.blocks[0].y;
cur_posY = new_posY – old_posY;
loopY = abs(cur_posY * 15);

if (new_posX != old_posX) {
change_posX = true;
}
else if (new_posX == old_posX) {
change_posX = false;
}
else if (new_posY != old_posY) {
change_posY = true;
}
else if (new_posY == old_posY) {
change_posY = false;
}

if (change_posX == true || change_posY == true) {
if (cur_posX > 10 && cur_posY > 3 && new_posX > 0 && new_posX < 160 && new_posY > 0 && new_posY < 100)
{
runBothMotorForw(loopX, dirA, stepA, loopY, dirB, stepB); //left down
change_posX = false;
change_posY = false;
}
else if (cur_posX < -10 && cur_posY < -3 && new_posX > 160 && new_posX < 300 && new_posY > 100 && new_posY < 200)
{
runBothMotorBack(loopX, dirA, stepA, loopY, dirB, stepB); //right up
change_posX = false;
change_posY = false;
}
else if (cur_posX > 10 && new_posX > 0 && new_posX < 160 ) {
runMotorForw(loopX, dirA, stepA); //left
}
else if (cur_posX < -10 && new_posX > 160 && new_posX < 300) {
runMotorBack(loopX, dirA, stepA); //right
}
else if (cur_posY > 3 && new_posY > 0 && new_posY < 100) {
runMotorForw(loopY, dirB, stepB); //down
}
else if (cur_posY < -3 && new_posY > 100 && new_posY < 200) {
runMotorBack(loopY, dirB, stepB); //up
}
else
{
change_posX = false;
change_posY = false;
stopMotor();
}
}
else {
stopMotor();
}
}
}
}
else {
stopMotor();
}
}

void runMotorForw(int _loop, int _dir, int _step) {
for (int i = 0; i < _loop; i++) { //200 steps per revolution
digitalWrite(_dir, HIGH);
digitalWrite(_step, HIGH);
delay(1);
digitalWrite(_step, LOW);
}
}
void runMotorBack(int _loop, int _dir, int _step) {
for (int i = 0; i < _loop; i++) {
digitalWrite(_dir, LOW);
digitalWrite(_step, HIGH);
delay(1);
digitalWrite(_step, LOW);
}
}

void runBothMotorForw(int _loop1, int _dir1, int _step1, int _loop2, int _dir2, int _step2) {
for (int i = 0; i < _loop1 && i < _loop2; i++) {
digitalWrite(_dir1, HIGH);
digitalWrite(_dir2, HIGH);
digitalWrite(_step1, HIGH);
digitalWrite(_step2, HIGH);
delay(1);
digitalWrite(_step1, LOW);
digitalWrite(_step2, LOW);
}
}

void runBothMotorBack(int _loop1, int _dir1, int _step1, int _loop2, int _dir2, int _step2) {
for (int i = 0; i < _loop1 && i < _loop2; i++) {
digitalWrite(_dir1, LOW);
digitalWrite(_dir2, LOW);
digitalWrite(_step1, HIGH);
digitalWrite(_step2, HIGH);
delay(1);
digitalWrite(_step1, LOW);
digitalWrite(_step2, LOW);
}
}

void stopMotor() {
digitalWrite(dirA, LOW);
digitalWrite(stepA, LOW);
digitalWrite(dirB, LOW);
digitalWrite(stepB, LOW);
}

 

 

 

 

 

 

orange_listTest

 

 Back to Process

 

 

 

 

 

 

Build

orange_gearBuild

For the railing system, I utilized a V-Slot Gantry System from Open Builds Part Store.

The rails are made of aluminum, the X-axis is 40 inches long and the Y-axis is 20 inches.

 

 

Here is the material breakdown for one of the rails (Y-axis 20 inches):

Qty. Description
4 Low Profile Screws – 25mm
2 Double Tee Nuts
2 Aluminum Spacer – 6mm
4 Low Profile Screws – 8mm
1 GT2 (2mm) Aluminum Timing Pulley – 30 Tooth
2 Eccentric Spacers
4 Delrin Solid V Wheel Kit
1 Smooth Idler Pulley Kit
1 Idler Pulley Plate
1 Motor Mount Plate for Nema 17 Stepper Motor
4 Cable Ties – 4″ (4 Single Cable Ties)
1 Aluminum Spacer – 3mm
1 V-Slot Gantry Plate (20mm)
4 M3 Socket Head Screws (4 Singles)
1 GT2 Timing Belt
1 V-Slot 20mm x 40mm Length 500mm
1 Nema 17 Stepper Motor

 

Step-by-step Build of the First Rail

 

 

 

Once I finished assembling one of the railing system, I started planning on how to put together the other railing. So one assembled railing (Y-axis) will sit on top of the other railing system (X-axis). This way, the gantry plate carrying the magnets can move in all directions (left, right, up, down, diagonal). I 3D modeled a bracket that would join and hold the rails together. And then using Tee Nuts and screws, I fastened the rails.

The Final Build of Rails

 

I then decided to build an enclosure for the railing system, the goal is to cover the gantry so that it gives it a magic essence when interacting with the ferrofluid. I used 4’x8′ Birch Plywood from Home Depot and secured all the sides using an electric staple gun. For the top frame, my advisor suggested to create a lip where we can slide in the tank and it will sit in smoothly. I used a CNC machine to create the lip.

Rail Enclosure

 

 

 

 

For the glass tank, I used Lexan MR5, a polycarbonate sheet. The measurement of the tank is 30″x15″x4″. One of the challenges for this tank was to make it water-tight. At first, I tried using Acrylics adhesive, a clear  water-thin solvent cement to glue the sides together, but it did not stick. Then I got some epoxy glue, and using a syringe applied it to all the sides and left it for a couple of hours to dry. Came back to check on it and it was holding together. To seal it, I used clear silicone caulk on all the sides and left it for over 24 hours to dry. The next day, I filled the tank full of water and left it for a few hours to check if it would leak. It was all good. I got my water-tight tank.

Glass Tank

 

 

 

 

orange_codeCode orange_listTest

 

 Back to Process

 

 

 

 

 

 

In the Real World

Aside from being used to create stunning sculptures, ferrofluid also has exciting real world applications. A major benefit of ferrofluid is that the liquid can be forced to flow via the positioning and strength of the magnetic field and so the ferrofluid can be positioned very precisely. Ferrofluids also have the capability of reducing friction,…

Introduction

Welcome!!   Have you ever heard of a liquid called ferrofluid? The term ferrofluid is of Latin origin. In Latin, ferro means magnet. Ferrofluid is a liquid that has very small pieces of a magnetic substance. This fluid can transform into a powerful magnet. How is this possible? When we think of magnets, we usually think of solid metal…

Retro jordans for sale Cheap foamposites jordan retro 5 cheap jordans for sale foamposites For Sale air jordan 30 Cheap nike lebron 13 Cheap jordans for sale Cheap jordans for sale jordans for cheap jordan retro 11 legend blue retro 12 jordans cheap soccer jerseys