Project tutorial
Sand Art Display

Sand Art Display © GPL3+

A Japanese zen garden built into a glass-covered picture frame.

  • 1,993 views
  • 2 comments
  • 10 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
see the construction manual PDF for all components.
×1
5 V stepper motor 28BYJ-48 with driver board ULN2003.
×1

Necessary tools and machines

09507 01
Soldering iron (generic)
see the construction manual PDF for all tools needed.

Apps and online services

About this project

Imagine a Japanese zen garden built into a glass-covered picture frame. Below the frame are electronics and robotics, creating geometric patterns and images in the sand. The effect is enchanting and magical, it is really zen-like to see ever-changing patterns and images slowly appear in the sand.

The Sand Art Display is a modern version of this traditional zen sand garden. It is a drawing machine that creates mandala-like patterns in the sand. The operation of this display is as follows: under the glass top is a thin layer of sand, under thes and a twin-engine robot moves a strong magnet to steer a steel ball through the sand. The robot is controlled by an Arduino mini computer playing a pattern program, similar to the way a music player plays MP3 songs. The table calibrates itself when plugged in and after this calibration a number of pre-programmed patterns can be selected using the push buttons.


Code

Sand Art Display program with three patternsArduino
Show !
/*
Stepper Motor Control progam for an X-Y table named "Sand Art Display".
This program drives two unipolar 5V DC stepper motors type 28BYJ-48.
The motors are attached to digital pins 4,5,6,7 and 8,9,10 and 11 of the Arduino UNO, 
via a driver board with IC ULN2003.
The motor power supply on this board is a separate 5V DC supply. 
GND is connected to the GND of the Arduino. 
The motors drive both axis of the sand art table with a 250 mm rack gear.
It starts the movement blue, yellow or white when the motors are resting in the full left & up position.
See www.apinventions.wordpress.com for the Sand Art Display building instructions.
Created March 12 2020 by Alex Pikkert.
*/

#include <Stepper.h>
//this sequence is special for the 28BYJ-48 stepper motor.
Stepper myStepperX(1024, 8,10,9,11);Stepper myStepperY(1024, 4,6,5,7);

int button    = A1; // analog button value 736(white)/451(yellow)/14(blue)
int select    = 0;  // select which road to follow... 
int resetled  = A2; // green led ready for instructions
int whiteled  = A3; // path 1
int yellowled = A4; // path 2
int blueled   = A5; // path 3
int xstop     = 12; // port end position left or right
int ystop     = 3;  // port end position up or down
int speed1    = 10; // slow speed
int speed2    = 15; // medium speed 
int speed3    = 25; // fast speed
int up        = 50; // length of standard step up
int down      = -50;// length of standard step down  
int left      = 50; // length of standard step left
int right     = -50;// length of standard step right
int n=0;            // counter flag up/down
int m=0;            // counter flag left/right
int x=0;            // left/right number of steps
int y=0;            // up/down number of steps
int d=0;            // counter for step difference

void setup() {
myStepperX.setSpeed(speed3);myStepperY.setSpeed(speed3);
pinMode(3,INPUT_PULLUP);pinMode(12,INPUT_PULLUP);pinMode(A1,INPUT_PULLUP);
pinMode(A2,OUTPUT);pinMode(A3,OUTPUT);pinMode(A4,OUTPUT);pinMode(A5,OUTPUT);
myStepperX.step(5*left);myStepperY.step(5*up);// always move to left/up corner start position
}

void loop() {
myStepperX.setSpeed(speed3);myStepperY.setSpeed(speed3);
digitalWrite(whiteled,LOW);digitalWrite(yellowled,LOW);digitalWrite(blueled,LOW);
y = digitalRead(ystop);if(y==HIGH) {myStepperY.step(4*up);}
x= digitalRead(xstop);if(x==HIGH) {myStepperX.step(4*left);}

if (y==LOW && x==LOW) // left/up start position
{ digitalWrite(resetled,HIGH);
  select = analogRead(button);
  if (select <50){blue();}
  if (select >50 && select <600){yellow();}
  if (select >600 && select <800){white();}
}

}
//PONG
void blue(){
myStepperX.setSpeed(speed2);myStepperY.setSpeed(speed2);
digitalWrite(blueled,HIGH);digitalWrite(resetled,LOW);

y = digitalRead(ystop);if(y==LOW && n==0){myStepperY.step(4*down);n=1;}
y = digitalRead(ystop);if(y==HIGH && n==1){myStepperY.step(2*down);}
y = digitalRead(ystop);if(y==LOW && n==1){myStepperY.step(4*up);n=0;} 
y = digitalRead(ystop);if(y==HIGH && n==0){myStepperY.step(2*up);}

x = digitalRead(xstop);if(x==LOW && m==0){myStepperX.step(4*right);m=1;}
x = digitalRead(xstop);if(x==HIGH && m==1){myStepperX.step(2*right);}
x = digitalRead(xstop);if(x==LOW && m==1){myStepperX.step(4*left);m=0;} 
x = digitalRead(xstop);if(x==HIGH && m==0){myStepperX.step(2*left);}
blue();
}

//PLOUGH
void yellow(){
myStepperX.setSpeed(speed2);myStepperY.setSpeed(speed2);
digitalWrite(yellowled,HIGH);digitalWrite(resetled,LOW);
x=73-d;myStepperX.step(x*right);
y=56-d;myStepperY.step(y*down);
d=d+3;
x=73-d;myStepperX.step(x*left);
y=56-d;myStepperY.step(y*up);
d=d+3;
while(y<5 || x< 5){} ;
yellow();
}

//WAFFLE 
void white(){
myStepperX.setSpeed(speed2);myStepperY.setSpeed(speed2);
digitalWrite(whiteled,HIGH);digitalWrite(resetled,LOW);
if(d==0){
if(n==0){myStepperY.step(5*down);}
y = digitalRead(ystop);if(y==LOW && n==0){myStepperX.step(11*right);n=1;x=x+1;}
if(n==1){myStepperY.step(5*up);}
y = digitalRead(ystop);if(y==LOW && n==1){myStepperX.step(11*right);n=0;x=x+1;}
if(x >7){d=1;y=0;n=0;}
}
if (d==1){
if(n==0){myStepperX.step(5*left);}
x = digitalRead(xstop);if(x==LOW && n==0){myStepperY.step(11*down);n=1;y=y+1;}
if(n==1){myStepperX.step(5*right);}
x = digitalRead(xstop);if(x==LOW && n==1){myStepperY.step(11*down);n=0;y=y+1;}
while(y >5){};
}
white();
}

Custom parts and enclosures

construction manual
construction manual

Schematics

Sand Art Display wiring diagram
Sand art display diagram sgtoxcopie

Comments

Similar projects you might like

Pixel Art on OLED Display

Project tutorial by madnerd and labsud

  • 9,769 views
  • 1 comment
  • 23 respects

GPS Location Display With GPS And TFT Display Shields

Project tutorial by Boian Mitov

  • 18,121 views
  • 7 comments
  • 37 respects

LED Matrix + Motion Sensor Door Display [Arduino Holiday]

Project tutorial by HeathenHacks

  • 6,859 views
  • 5 comments
  • 23 respects

128 x 64 LED Flat Panel Display

Project tutorial by Doug Domke

  • 3,585 views
  • 1 comment
  • 14 respects

Soil Moisture Sensor With LCD Display

Project tutorial by Patel Darshil

  • 41,216 views
  • 12 comments
  • 59 respects

Programmable Pocket Power Supply with OLED Display

Project tutorial by Shahariar

  • 9,232 views
  • 8 comments
  • 42 respects
Add projectSign up / Login