Skip to the content
2 layers54.2 × 81.5 mmSand drawing, the printed circuit board in 3D

Code, PCBs and CAD for a SCARA-based sand drawing robot

Size
54.2 × 81.5 mm
Copper layers
2
Thickness
1.6 mm
Parts
41
Nets
47
Pads
158
Tracks, vias
229, 15
Pours
4
Routed
Yes
KiCad
KiCad 7 (file 20221018)
Created
12 Apr 2020
Updated
4 Nov 2024

Overview

Sand drawing is an open-source printed circuit board by tjhowse, from the tjhowse/sand_drawing repository on GitHub. It is a 2-layer board of 54.2 × 81.5 mm with 41 parts on 47 nets, routed with 229 tracks and 15 vias.

It is built around the ESP32-WROOM-32D, AP63203WU and CGA3E2X7R1H104K080AA, with the CRGP0603F10K, CGA5L1X7R1V106K160AE and CL21C101JBANNNC among its other parts. Its parts include 17 diodes, 6 capacitors, 6 connectors, 2 ICs and 2 switches. It belongs with the ESP32 boards of this library.

Main components

6

README

README.md

Huh?

a photo of the sand drawing robot

So you've been reading about all the benefits of this "mindfulness" thing and you want to give it a try. You do some research and learn it requires "meditation", "introspection" and other kinds of tedious woo. Who has time for that? It's {current_year} for christ's sake! I don't want a tiny tray of rocks and sand on my desk to rake around. Surely there's some turn-key solution to this problem already.

That's what this project is for. Outsource responsibility for an ordered mind to make more time for the important things, like computer games. And croissants.

Oh

This project (will contain/contains) all the knowledge you will need to build your own sand drawing robot. Heavily inspired by the likes of Sandsara and Sisyphus. It's a robot that moves a ball around in a bed of sand to draw cool patterns. The patterns can be updated via wifi, and it can cycle through them, you can create your own, etc, etc. This project is open source, cheap, and hopefully as easy as possible to build.

Building it

Skills required

This isn't a Lego set. You'll need to have access to the following skills:

  • Basic woodworking,
  • Intermediate soldering,
  • Following technical instructions,
  • Drilling a hole sideways through steel rod,
  • Recovering from setbacks.

I'll do my best to make the instructions as comprehensive and comphrehensible as I can. I appreciate any and all feedback.

Videos

Playlist on Youtube. Maybe worth watching.

PCB

The PCB is quite simple and cheap. PCBWay generously sponsored a production run of the v1.2 PCBs and they came out perfect. You can order the PCB using this link and I'll get a small cut. PCBWay asked me to review the board in a youtube video and link it in the readme, but required no further quid pro quo.

Build logs

For now the build logs are on my wiki. Over time they'll morph into actual instructions and end up in this repo.

Bill of materials

None of these parts are particularly hard to find. Check ebay and whatnot. Try to buy local if you can. It's hard to guess how much it will all cost in total, but I've tried to design everything to be as economical as possible. Excluding the housing I would (very roughly) estimate the BoM to come out to around AUD$200. The housing could be as cheap as AUD$50 (Melamine board, polycarbonate) or as expensive as you want, with lacquered hardwood and tempered glass.

text
These bills of material are slightly out of date. Consult the youtube videos.

Mechanical

ItemTypeCountNote
Laser cut partsVariousManyThe current best solution is made from 3mm laser cut plywood. A 3D printed variant is quite possible.
Stepper pulleyGT2-20, 12.35mm high2My steppers had pulleys from the factory.
BeltS2M belt 120mm2S2M ≈ GT2.
BeltS2M belt 278mm1
Shaft 18mm x 90mm1Mild steel is easier to cross-drill than stainless.
Shaft 28mm x 33mm1
Bearing6086Cheap skate bearings are fine.
Washers8mm ID, 15.7mm OD5OD not critical, but it must not rub on outer race of bearings.
Washers3mm ID, 6.8mm OD12
BoltsM3x12mm8I used all 20mm and cut them to length.
BoltsM3x20mm2
Nylock nutsM32Nylock not critical.
Pins2mm diameter5Roll pins would be best, I used nails. +1 extra for pinning shaft 1 into the bearings.
Magnets12mm diameter, 2mm high neodymium2-4Situational dimensions. Get a variety of sizes to aid experimentation.
Cable ties200mm x 4.6mm Nylon2Dimensions not critical.

Electrical

ItemTypeCountNote
MicrocontrollerESP-WROOM-32D1Wifi and bluetooth built-in
Stepper motorNEMA-172200 steps/revolution, around 40mm long, at least 30 N.cm of holding torque. It's not critical, really.
Stepper driverPololu pinout2A4988, DRV8825 or TMC2100 in increasing order of preference
PCBCustom made1The design is here. It's easier and cheaper to have one made than you might imagine.
Hall effect sensorsSS49E2Used for detecting arm position.
PSU12v DC 1A1A wall wart should be fine.
Stepper driver socket16x1 2.54mm female2https://au.rs-online.com/web/p/pcb-sockets/2304893/
Stepper motor socket4x1 3.5mm2https://au.rs-online.com/web/p/pcb-headers/8971039/
Stepper motor plug4x1 3.5mm2https://au.rs-online.com/web/p/pcb-terminal-blocks/8971004/
Optoswitch socket3x1 3.5mm2https://au.rs-online.com/web/p/pcb-headers/8971020/
Optoswitch plug3x1 3.5mm2https://au.rs-online.com/web/p/pcb-terminal-blocks/8971001/
Power socket2x1 3.5mm1https://au.rs-online.com/web/p/pcb-headers/8971026/
Power plug2x1 3.5mm1https://au.rs-online.com/web/p/pcb-terminal-blocks/8970998/
Buttons6mm2https://au.rs-online.com/web/p/tactile-switches/1359534/
UART Header3x1 2.54mm male1https://au.rs-online.com/web/p/pcb-headers/8967364/
12VDC Barrel socket2.1mm pin1https://au.rs-online.com/web/p/dc-power-sockets/0448370/

Enclosure

ItemTypeCountNote
BaseWooood?1Holds the steppers and circuitry.
TopWooood?1Any convex polygon should work.
BedGlass?1
LidGlass1
SandSand31378908< 100 μm grains, dry.

Flashing

To flash the software onto the ESP32 you'll need to use the provided scripts flash32.sh and write32.sh. You'll have to update them with the current version of micropython and the device name of your serial port adapter. When flashing micropython you'll need to hold down the IO0 button while connecting power, then release it five or so seconds after powering on. You can then run flash32.sh and it'll write the "OS" onto the chip. Then you can repower again and run write32.sh to load the project's scripts onto the board.

Communication

The ESP-WROOM-32 has wifi and BLE built in. Currently the robot connects to a wifi network, then an MQTT server, to receive commands. Bluetooth should also be possible in the future.

MQTT Topics

There are a few topics that the robot listens to. Each topic starts with {secrets.mqtt_root}/sand_drawing/. I suggest you publish patterns/generators with the retain bit so the robot starts up and then begins that pattern.

TopicExample payloadDescription
patternG28 X,G28 Y,G1 X0 Y175,G1 X123 Y123,G1 X175 Y0,J0 2Starts drawing the pattern defined by the GCODE in the payload.
generatorHereStarts drawing the pattern defined by the generator in the payload. See below for details on generators.
save_generator1.pat {generator string}Saves the generator to a file in the robot's flash storage. The file extension must be .pat. A blank string will erase the generator.
run_generator1.patStarts drawing the previously saved generators.
delete_generator1.patDeletes a generator saved to the robot.
list_generatorsN/APublishes a list of filenames to generator_list topic.
shuffle_generators3600Randomly picks a saved generator and starts drawing it. Optionally provide a number of seconds before choosing another random generator

Configuration

There are some files you'll need to edit before your robot will work for you, probably. #TODO populate this section.

Pattern definition

There are currently two ways to design patterns for the robot.

GCODEs

This is a sequence of coordinates that define the path of the ball, as well as changing modes and looping. The following GCODES are currently supported. GCODES are separated by a comma.

NameGCODEExampleDescription
Home axisG28G28 X,G28 Y,Home either the X or Y axis. Any command that needs an absolute position reference will fail unless both axes have been homed first.
MoveG1G1 X10 Y50 S100,Go to the X and Y coordinates specified at 100mm/s. Currently the speed field is ignored. The G1 movement mode carefully tracks every step and should be perfectly accurate if your steppers do not slip.
Fast moveG0G0 X10 Y50 S100,Same as G1 however the step signal square wave is generated using PWM so some resolution is lost. At time of writing it is not well-supported. It's really fast though.
Coordinate modeG16G16 0,This setting is used to control the interpretation of the X and Y parameters in the G0 and G1 commands. 0: Raw speed, 1: Raw angle, 2: Cartesian (Default), 3: Polar (unimplemented)
JumpJ0J0 3,This jumps to the specified line in the GCODE-defined pattern. Used for creating loops.
Absolute coordinate modeG90G90Puts the robot into absolute movement mode. Coordinates in G0/G1 commands are interpreted as absolute position references. (Default)
Relative coordinate modeG91G91Puts the robot into relative movement mode. Coordinates in G0/G1 commands are interpreted as movement vectors from the previous position.

Generators

You can define a pattern using a python generator function. Examples here. This is probably the best option for non-trivial patterns.

Tread lightly

Keep the target hardware in mind when writing generators. It's very resource-constrained. Try to limit RAM usage, and think hard before importing anything. There are some helper functions and constants in-scope that you can use.

Parts

41
QtyValueFootprintReferences
17100V 850mV@2A Schottky DiodeDiode_SMD:D_SMBD1, D2, D3, D4, D5, D6, D7, D8, D10, D11, D12, D13, D14, D15, D16, D17 +1
4MountingHoleMountingHole:MountingHole_3.2mm_M3H1, H2, H3, H4
2100nF/50V ±10%Capacitor_SMD:C_0603_1608MetricC3, C6
222µF/25V ±20%Capacitor_SMD:C_1206_3216MetricC4, C5
110k 1% 0.25WResistor_SMD:R_0603_1608MetricR1
110µF/35V ±10%Capacitor_SMD:C_1206_3216MetricC2
112V GNDConnector_Phoenix_MC:PhoenixContact_MCV_1,5_2-G-3.5_1x02_P3.50mm_VerticalJ0
150V 100pF ±5%Capacitor_SMD:C_0805_2012MetricC1
16.8µHsand_drawing_parts:WURTH_6060L1
1AP63203WUsand_drawing_parts:TSOT-26-6U1
1Driver1Module:Pololu_Breakout-16_15.2x20.3mmA1
1Driver2Module:Pololu_Breakout-16_15.2x20.3mmA2
1ENButton_Switch_THT:SW_PUSH_6mmSW1
1ESP32-WROOM-32DCustom:ESP32-WROOM-32U2
1IO0Button_Switch_THT:SW_PUSH_6mmSW2
1Opto 1Connector_Phoenix_MC:PhoenixContact_MCV_1,5_3-G-3.5_1x03_P3.50mm_VerticalJ3
1Opto 2Connector_Phoenix_MC:PhoenixContact_MCV_1,5_3-G-3.5_1x03_P3.50mm_VerticalJ4
1Stepper1Connector_Phoenix_MC:PhoenixContact_MCV_1,5_4-G-3.5_1x04_P3.50mm_VerticalJ1
1Stepper2Connector_Phoenix_MC:PhoenixContact_MCV_1,5_4-G-3.5_1x04_P3.50mm_VerticalJ2
1UARTConnector_PinSocket_2.54mm:PinSocket_1x03_P2.54mm_VerticalJ5

Similar boards

  • 4 layers220.5 × 51 mmMuonScope, the printed circuit board in 3D

    MuonScope

    manvalan/MuonScope

    Piano di rivelazione MuonScope con 16 fotodiodi VBPW34S in matrice 4×4 a passo 10 mm, per il bus MIKILAB REV5.1.

    102 parts
  • 4 layers115 × 130 mmFantoccia carrier, the printed circuit board in 3D

    Fantoccia carrier

    adamjvr/fantoccia

    An Open Source DAQ hardare system based on https://github.com/marionette-daq/marionette-hardware

    29 parts
  • 4 layers120 × 107 mmSL23-modem tester, the printed circuit board in 3D

    SL23-modem tester

    JitterCompany/debug-tools

    Collection of useful utility PCBs for development purposes

    229 partsMIT
  • 4 layers49.5 × 56.8 mmBLE CAN module, the printed circuit board in 3D

    BLE CAN module

    shivamtiwari020505/Automotive-BLE-CAN-Module

    KiCad hardware design for an automotive BLE-to-CAN module

    110 parts
  • 2 layers100 × 100 mmBMS V4, the printed circuit board in 3D

    BMS V4

    0hasant/BMS-Version-4

    Solar Team Solaris Version 4 BMS

    249 parts2

Questions

How big is the Sand drawing PCB?

It measures 54.2 × 81.5 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Sand drawing use?

41 parts, built around the ESP32-WROOM-32D, AP63203WU, CGA3E2X7R1H104K080AA and CRGP0603F10K. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Sand drawing KiCad files?

From the tjhowse/sand_drawing repository on GitHub, at the commit this page was made from: the board is pcb/sand_drawing/sand_drawing.kicad_pcb and its schematic pcb/sand_drawing/sand_drawing.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Sand drawing design in my own project?

Its repository states no licence, so its author keeps all rights: ask tjhowse before reusing the design.