Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
russhughes committed May 31, 2020
0 parents commit 7d25468
Show file tree
Hide file tree
Showing 83 changed files with 212,852 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
venv
.vscode
.DS_Store
*~
__pycache__

#sphinx build folder
docs/build

#ignore gcode files
*.gcode
66 changes: 66 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
TurtlePlotBot
=============

The TurtlePlotBot is a MicroPython based 3D printed drawing robot inspired
by `MakersBox's <https://www.thingiverse.com/MakersBox>`_ `Arduino Chassis
for Drawing Robot <https://www.thingiverse.com/thing:1091401>`_. The
TurtlePlotBot can be easily built in a couple of hours and offers a fun
environment to learn python programming and robotics.

|
.. figure:: images/hello.jpg
:width: 400px
:align: center

Say "Hello!" to my little friend!

|
The software that runs the TurtlePlotBot is modular and includes the
`turtleplot` module. The `turtleplot` module contains the methods needed to
turn turtle graphics commands into simple robot movements. You can use the
`turtleplot` module run your own robot using different hardware without
having to write all the python code for each of the turtle graphics commands.

A TurtlePlotBot is built from 3D printed parts, a pair of 28BYJ-48
stepper motors and uses a MG90S mini servo to lift and lower a pen used for
drawing.

An ESP-32 Based Microcontroller module with a 240x135 LCD display
running MicroPython is paired with a `ESP32 DrawBot Board
<https://penfold.owt.com/turtleplotbot3/assembly-part2.html#drawbot-board>`_
to provide the interface circuitry needed to run the stepper motors, servo,
MicroSD card and a five way joystick. The TurtlePlotBot has Wifi capability
allowing it to be controlled and programmed wirelessly from a computer,
smartphone or tablet.

A menu system provides an easy way to configure the TurtlePlotBot, connect to
or create a Wifi access point as well as running TurtlePlotBot MicroPython
programs without the use of a computer or another device.


* Connect to a Wifi Access Point

=================================== ===================================
.. image:: images/main_menu-1-1.jpg .. image:: images/main_menu-1-5.jpg
=================================== ===================================

* Create a Wifi Access Point

=================================== ===================================
.. image:: images/main_menu-3-1.jpg .. image:: images/main_menu-3-3.jpg
=================================== ===================================

* Write a message using a font

=================================== ===================================
.. image:: images/message-2.jpg .. image:: images/message-10.jpg
=================================== ===================================


TurtlePlotBot Documentation
^^^^^^^^^^^^^^^^^^^^^^^^^^^

See the `TurtlePlotBot Documentation <https://penfold.owt.com/turtleplotbot3>`_
for more details.
20 changes: 20 additions & 0 deletions boot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This file is executed on every boot (including wake-boot from deepsleep)
"""
boot.py
"""
import gc
import sys

sys.path.append('/programs')

# uncomment to enable webrepl
#import webrepl
#webrepl.start()

def reload(mod):
mod_name = mod.__name__
del sys.modules[mod_name]
gc.collect()
return __import__(mod_name)


15 changes: 15 additions & 0 deletions examples/box_better.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'''
Better way to draw a box
'''

from turtleplotbot import TurtlePlotBot
bot=TurtlePlotBot()
bot.pendown()

for _ in range(4):
bot.forward(30)
bot.left(90)

bot.done()

__import__("menu") # optional return to turtleplotbot menu
23 changes: 23 additions & 0 deletions examples/box_even_better.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'''
Even better way to draw boxes
'''

from turtleplotbot import TurtlePlotBot
bot=TurtlePlotBot()

def box(bot, size):
bot.pendown()

for _ in range(4):
bot.forward(size)
bot.left(90)

bot.penup()

box(bot, 10)
box(bot, 20)
box(bot, 30)

bot.done()

__import__("menu") # optional return to turtleplotbot menu
23 changes: 23 additions & 0 deletions examples/box_simple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'''
The simple way to draw a box
'''

from turtleplotbot import TurtlePlotBot
bot=TurtlePlotBot()
bot.pendown()

bot.forward(30)
bot.left(90)

bot.forward(30)
bot.left(90)

bot.forward(30)
bot.left(90)

bot.forward(30)
bot.left(90)

bot.done()

__import__("menu") # optional return to turtleplotbot menu
43 changes: 43 additions & 0 deletions examples/circle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'''
Approximate a circle or ellipse using a `n` sided polygon
'''

import math

from turtleplotbot import TurtlePlotBot
bot=TurtlePlotBot()

def circle(bot, radius_x, radius_y, sides):
'''
Approximate a circle or ellipse by drawing a `n` sided polygon
Args:
radius_x: horizonal radius
radius_y: vertical radius
sides: number of line segments to draw
Note:
To draw circle use the same value for both radii
'''
step = 2 * math.pi / sides

for theta in range(0, 2 * math.pi, step):
x = radius_x * math.cos(theta)
y = radius_y * math.sin(theta)

if theta is 0:
start_x = x
start_y = y
bot.goto(x, y)
bot.pendown()
else:
bot.goto(x, y)

bot.goto(start_x, start_y)
bot.penup()

circle(bot, 30, 30, 20)
bot.done()

__import__("menu") # optional return to turtleplotbot menu
8 changes: 8 additions & 0 deletions examples/circle2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from turtleplotbot import TurtlePlotBot

bot=TurtlePlotBot()
bot.pendown()
bot.circle(20,360)
bot.done()

__import__("menu") # optional return to turtleplotbot menu
40 changes: 40 additions & 0 deletions examples/menu_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
"""
menu_example.py - Show a menu of numbers that the user can select and show the
number picked. Pressing the left button will exit the menu and program.
"""

import vga2_bold_16x16 as font
import tftui

def main(ui):
"""
Main routine
"""

menu = [
"One",
"Two",
"Three",
"Four",
"Five",
"Six",
"Seven",
"Eight",
"Nine"
]

option = 0
while option is not None:
option = ui.menu("Pick a Number", menu, option)
if option:
ui.cls("You Picked:", 2)
ui.center(menu[option], 3)
ui.center("Press to", 5)
ui.wait("Continue", 6)

ui.cls("Bye!")

main(tftui.UI(font,1))

__import__("menu") # return to turtleplotbot menu

26 changes: 26 additions & 0 deletions examples/polygon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'''
Draw a `n` sided polygon
'''
from turtleplotbot import TurtlePlotBot
bot=TurtlePlotBot()

def polygon(bot, sides, length):
'''
Draw a 'sides' sided polygon
Args:
sides: number of sides in polygon
length: length of eacg side
'''
angle = 360 / sides
bot.pendown()
for _ in range(sides):
bot.forward(length)
bot.right(angle)

bot.penup()

polygon(bot, 8, 20)
bot.done()

__import__("menu") # return to turtleplotbot menu
28 changes: 28 additions & 0 deletions examples/star.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
'''
Draw a star
'''

from turtleplotbot import TurtlePlotBot
bot=TurtlePlotBot()

def star(bot, points, length):
'''
Draw a 'n' pointed star with 'length' sides
Args:
sides: number of points
length: length of each side
'''
angle = 180.0 - 180.0 / points
bot.pendown()

for _ in range(points):
bot.forward(length)
bot.left(angle)
bot.forward(length)

bot.penup()

star(bot, 5, 30)

__import__("menu") # return to turtleplotbot menu
13 changes: 13 additions & 0 deletions examples/write.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'''
Write a message.
'''

from turtleplotbot import TurtlePlotBot
bot=TurtlePlotBot()

# make the text 2 times larger then the default
bot.setscale(2)
bot.write("Hello!", "fonts/scripts.fnt")
bot.done()

__import__("menu") # return to turtleplotbot menu
Binary file added fonts/astrol.fnt
Binary file not shown.
Binary file added fonts/cyrilc.fnt
Binary file not shown.
Binary file added fonts/gotheng.fnt
Binary file not shown.
Binary file added fonts/gothger.fnt
Binary file not shown.
Binary file added fonts/gothita.fnt
Binary file not shown.
Binary file added fonts/greekc.fnt
Binary file not shown.
Binary file added fonts/greekcs.fnt
Binary file not shown.
Binary file added fonts/greekp.fnt
Binary file not shown.
Binary file added fonts/greeks.fnt
Binary file not shown.
Binary file added fonts/italicc.fnt
Binary file not shown.
Binary file added fonts/italiccs.fnt
Binary file not shown.
Binary file added fonts/italict.fnt
Binary file not shown.
Binary file added fonts/japan.fnt
Binary file not shown.
Binary file added fonts/lowmat.fnt
Binary file not shown.
Binary file added fonts/marker.fnt
Binary file not shown.
Binary file added fonts/meteo.fnt
Binary file not shown.
Binary file added fonts/misc.fnt
Binary file not shown.
Binary file added fonts/music.fnt
Binary file not shown.
Binary file added fonts/romanc.fnt
Binary file not shown.
Binary file added fonts/romancs.fnt
Binary file not shown.
Binary file added fonts/romand.fnt
Binary file not shown.
Binary file added fonts/romanp.fnt
Binary file not shown.
Binary file added fonts/romans.fnt
Binary file not shown.
Binary file added fonts/romant.fnt
Binary file not shown.
Binary file added fonts/scriptc.fnt
Binary file not shown.
Binary file added fonts/scripts.fnt
Binary file not shown.
Binary file added fonts/symbol.fnt
Binary file not shown.
Binary file added fonts/uppmat.fnt
Binary file not shown.
Loading

0 comments on commit 7d25468

Please sign in to comment.