A Raspberry Pi based plotter (SchetsjesJS)

I’ve seen something awesome when I was at JSConf in Budapest. An Arduino controlled by a Raspberry Pi drawing a giant skull on a whiteboard. I absolutely need this in my life, let’s try to build it for myself!

At JSConf the organisers invited the local hacker space from Budapest at one of the after parties and I really enjoyed myself there. At this after party they had retro consoles, a VR room and the opportunity for people to solder and watch a 3D printer and a device that drew a skull on a white board. The ‘plotter’ as they called it was based on a package you can buy (read more about it on the Makelangelo website), they assembled it and made it draw. I was amazed. I’ve seen a plotter before in a museum but having it draw anything you’d like at home would be crazy!

The plotter at JSConf Budapest in action

Since I’ve seen the plotter I’ve been unable to let the idea go to try to build one myself. I think it’s pretty ambitious but I’m going to try it anyway! I have an Arduino Mega at my disposal but I’m planning to build it using only my Raspberry Pi 2B. I think it will be a bit less complex without the micro controller, and the advantage of the Raspberry Pi would be that I can possibly control it using JavaScript, a language I know. I’m confident the project will be possible with JavaScript, therefore I’m claiming the name ‘SchetsjesJS’ at this very moment! (a ‘schets’ is a sketch/doodle in Dutch. ‘schetsjes’ are the little/cute version of it :))

The hardware

At the time of writing I’ve already ordered the components I need for this project: a stepper motor HAT from Adafruit and two 200-step stepper motors. I have no experience with motors whatsoever but I’m confident I’ll find my way since Adafruit has some nice demo code examples. I’ve also soldered the components already, and tested them with the demo code. Everything seems to work and my home didn’t burn down, I’m satisfied!

The Raspberry Pi with the Motor HAT on top of it. Pretty neat soldering if I say so myself!

The plan

What’s a project without a basic plan? A hobby! Oh, wait, this is a hobby. Well, even hobbies need plans, and this is it in a nutshell:

  1. Buy a MotorHAT and stepper motors
  2. Solder/assemble the MotorHAT
  3. Test the motors with demo code
  4. See if we can move the motors using JavaScript
  5. Assemble a basic drawing board
  6. Goal 1: draw a rectangle
    1. (This allows me to see what the maximum top/right/left/bottom positions are with the amount of turns and rope on the motors. It will likely also show me problems I didn’t think of before)
  7. Think of a way how the instructions need to be coded: array with top/left position? Or something different?
  8. Make a sample instruction set, based on an image and in the the newly thought of instructions convention
    1. For now a resolution of 10×10 pixels would be ok
    2. Determine shade of grey per pixel (5 shades)
    3. Decide what to do with the shades
  9. Goal 2: draw something according to the hard coded test routine
  10. Make a web-app that can convert an image to array of instructions
  11. Make it draw different patterns (what pattern I will end up with at this point is probably the easiest one at first)

SchetsjesJS: start your engines!

I’m excited about this new project but I’m also weary: this could prove to be a lot harder than I thought. I have a good sense of realism for this project: it could take a while. Having goal 1 met by drawing a rectangle will help a lot: this proves it could work, which grants me the energy to keep on going when the expected problems arise :) Go go goooo!

 

Like to see how my plotter progresses? Read part two: SchetsjesJS: moving the motors using Javascript!