pgbops.blogg.se

Etch a sketch art
Etch a sketch art













etch a sketch art
  1. #Etch a sketch art how to
  2. #Etch a sketch art code
  3. #Etch a sketch art series

for step in range ( 40 ): horizontalMotor.

#Etch a sketch art code

For example, the code below will create a nice smooth diagonal line for us. For curves and diagonal lines, we can get the behavior we’re looking for by alternating instructions to the horizontal and vertical motors.

#Etch a sketch art series

Now, as long as we know a path that we want to travel along, we can come up with a way to convert it to a series of instructions like above. rotate ( - 40 ) # move cursor 40 units down rotate ( - 40 ) # move cursor 40 units left rotate ( 40 ) # move cursor 40 units right I created a class to represent the motor, abstracting around the information from this guide I’ll be using this in the code is in the following way: horizontalMotor = StepperMotor ( horizontal_pins ) verticalMotor = StepperMotor ( vertical_pins ) horizontalMotor.

etch a sketch art

The raspberry pi python library rpi lets us control the motor via the pins. The descriptions below will be mostly high level but all the code for this project is available on GitHub if you’d like to dive in at a deeper level. I wanted to do it in a fully automated way where the only input is a picture and the output is a cleanly drawn image. The advantage here is great paths, but creating the toolpaths is kind of a process. Other projects used toolpaths like the way 3D printers and metal cutting machines determine the routes they take. Some projects used the etch a sketch to draw in a grid and then “color” in the cells so that it looked like a picture. They seemed to approach the drawing in one of two ways. When I started out, I googled to see if anyone had done things like this before. There’s a few different ways to go about this portion of the project. If it’s too tight, the motor will be squeezed against the coupler and not be able to rotate. With a screw too loose and the motor will wiggle around when it’s trying to rotate. This can be tricky if the wood is not appropriately sized. I glued the wood on the bottom to the etch-a-sketch body. I went to a local hardware store with the dimensions of the build and they were able to cut me a block of wood that I could screw the motors into to keep them stable. Without doing anything, if we set the motor to rotate, the knob will actually stay still and the motor itself will rotate! There’s quite a bit of resistance on the etch a sketch knobs. It’s somewhat flexible, with two small sets of screws on either side that allow it to be tightened around each of the shafts. The motor also rotates a shaft, so to connect them together I used a chinese-finger-trap-like device called a coupler. With some force, the knobs can be removed from the etch-a-sketch. Here’s a link to the guide I followed to get this set up. By changing the voltage on these pins, I can make motors to rotate. I connect a few of these pins to each of two controllers + motors. Additionally, it has a set of GPIO pins to use. Since the Raspberry Pi is just a tiny computer, we’re going to be able to use all the python libraries we know and love. I’ve got the Amazon links above so it’s extra clear what I got – it seems like for these parts many of the manufacturers seem pretty similar, so I just picked the cheapest at the time.

#Etch a sketch art how to

I’ve always wanted to learn more about how to use hardware with python so I was pretty excited to start this one. My hope was to get to a point where my program could draw things better than I could. For the reasons above, recreating pictures by hand is tedious and extremely difficult. Write a program that uses some motors to draw nice pictures on an etch-a-sketch. If you want to undo something you’ll have to redo your whole masterpiece.

  • you can’t draw two objects that are not connected.
  • Diagonals and curves require a steady precision that most children 3+ simply don’t have.
  • knobs only move the cursor up/down/left/right.
  • The popularity of the device is sort of interesting because it has lots of annoying problems: It was even a big enough deal to be a character in Toy Story 1 and 2! Ever since then, it’s been a staple toy in homes, daycares, waiting rooms and schools – over 100 million have been sold worldwide. The Etch-A-Sketch was released by The Ohio Art Company in 1960. Can we combine some code and motors to make this toy produce nice pictures? The answer is… The etch-a-sketch is one of the most frustrating drawing toys from childhood.















    Etch a sketch art