├── .aspell.en.prepl
├── .aspell.en.pws
├── MagPi-Tiny-The-Robot-01-version-1.1.stl
├── MagPi-Tiny-The-Robot-02-version-1.1.stl
├── MagPi-Tiny-The-Robot-03-version-1.1.stl
├── MagPi-Tiny-The-Robot-version-1.1.dxf
├── MagPi-Tiny-The-Robot-version-1.1.pdf
├── MagPi-Tiny-The-Robot-version-1.1.svg
├── MagPi-Tiny-The-Robot-version-1.2.dxf
├── MagPi-Tiny-The-Robot-version-1.5.dxf
├── MagPi-Tiny-The-Robot-version-1.5.svg
├── MagPi-Tiny-The-Robot-version-1.6.dxf
├── MagPi-Tiny-The-Robot-version-1.6.svg
├── MagPi-Tiny-The-Robot.dxf
├── MagPi-Tiny-The-Robot.pdf
├── MagPi-Tiny-The-Robot.svg
├── README.md
├── lineFollowing.py
├── microSD-saver.dxf
├── microSD-saver.svg
├── multiplex.py
├── pseudo-drag.txt
├── pseudo-maze.txt
└── zbJoystick.py
/.aspell.en.prepl:
--------------------------------------------------------------------------------
1 | personal_repl-1.1 en 0
2 |
--------------------------------------------------------------------------------
/.aspell.en.pws:
--------------------------------------------------------------------------------
1 | personal_ws-1.1 en 0
2 |
--------------------------------------------------------------------------------
/MagPi-Tiny-The-Robot-version-1.1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Corteil/PiMag_Tiny_The_Robot/49027771fd967370937b79cc84bc5ef8c833f3ba/MagPi-Tiny-The-Robot-version-1.1.pdf
--------------------------------------------------------------------------------
/MagPi-Tiny-The-Robot-version-1.5.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
960 |
--------------------------------------------------------------------------------
/MagPi-Tiny-The-Robot-version-1.6.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
1000 |
--------------------------------------------------------------------------------
/MagPi-Tiny-The-Robot.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Corteil/PiMag_Tiny_The_Robot/49027771fd967370937b79cc84bc5ef8c833f3ba/MagPi-Tiny-The-Robot.pdf
--------------------------------------------------------------------------------
/MagPi-Tiny-The-Robot.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
794 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PiMag_Tiny_The_Robot
2 |
3 | Find everything for the PiMag robot Tiny, including the design & software files here.
4 |
5 | Chassis from version 1.1 wheelbase increased by 10mm.
6 |
7 | 3d files of "Tiny" created by Richard Hayler aka @rdhayler on the twiter. Richard used a fill density of 20% with PLA filament
8 |
9 | lineFollowing.py added
10 |
11 | Pseudo code for maze and speed challenges added
12 |
13 | Code for maze and speed challenges will be added soon, watch this space!
14 |
15 | modified PiBorg zbJoystick.py for rock candy controller added
16 |
17 | Added simple python library to control the Adafruit TCA9548A i2c multiplexer, the library is called multiplex.py
18 | an example will upload soon showing the use of the library.
19 |
20 | The best way to contact me is via Twiter, will answer when life allows.
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/lineFollowing.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # coding: Latin-1
3 |
4 | # some of the code in this program is from the example code by PiBorg.
5 | # more imformation can be found here.
6 | # https://github.com/piborg/zeroborg/
7 | #
8 | # the joy of open source code :-D
9 |
10 | # import libraries required
11 |
12 | import ZeroBorg
13 | import RPi.GPIO as GPIO
14 | import time
15 |
16 |
17 | # define pins for the line following sensor
18 |
19 | leftPin = 10
20 | middlePin = 9
21 | rightPin = 11
22 |
23 |
24 |
25 |
26 | # Setup pins for line following sensor
27 |
28 | GPIO.setmode(GPIO.BCM) # Broadcom pin-numbering scheme
29 |
30 | GPIO.setup(leftPin, GPIO.IN)
31 | GPIO.setup(middlePin, GPIO.IN)
32 | GPIO.setup(rightPin, GPIO.IN)
33 |
34 |
35 | # Setup the ZeroBorg
36 |
37 |
38 | ZB = ZeroBorg.ZeroBorg()
39 | ZB.Init()
40 | ZB.ResetEpo()
41 |
42 | # Power settings
43 | voltageIn = 8.4 # Total battery voltage to the ZeroBorg (change to 9V if using a non-rechargeable battery)
44 | voltageOut = 6.0 # Maximum motor voltage
45 |
46 | # Setup the power limits
47 | if voltageOut > voltageIn:
48 | maxPower = 1
49 | else:
50 | maxPower = voltageOut / float(voltageIn)
51 |
52 | # kill power to motors
53 |
54 | ZB.MotorsOff()
55 |
56 | # funtions
57 |
58 | def readInputs():
59 | left = 0
60 | middle = 0
61 | right = 0
62 |
63 | if GPIO.input(leftPin) == False:
64 | print("left\n")
65 | left = 1
66 |
67 | if GPIO.input(middlePin) == False:
68 | print("middle\n")
69 | middle = 1
70 |
71 | if GPIO.input(rightPin) == False:
72 | print("right\n")
73 | right = 1
74 |
75 | returnValues = [left, middle, right]
76 | return returnValues
77 |
78 | # define motor speed values and set to 0.0
79 |
80 | driveLeft = 0.0
81 | driveRight = 0.0
82 | oldDriveLeft = 0.0
83 | oldDriveRight = 0.0
84 |
85 | # control loop
86 |
87 | while True:
88 |
89 |
90 | line = readInputs() # call the read line following sensor function
91 | # print line # remove hash for debuging
92 | time.sleep(0.01) # adjust if 100 per second reads if too fast or slow
93 |
94 | # if line is on left turn right
95 |
96 | if (line == [0, 1, 1]):
97 | driveLeft = -0.6
98 | driveRight = 0.6
99 |
100 | # if line is central, power both motors
101 |
102 | if (line == [1, 0, 1]):
103 | driveLeft = 0.5
104 | driveRight = 0.5
105 |
106 | # if line is right turn left
107 |
108 | if (line == [1, 1, 0]):
109 | driveLeft = 0.6
110 | driveRight =-0.6
111 |
112 | # if can't see line, repeat last move
113 |
114 | if (line == [1, 1, 1]):
115 | driveLeft = oldDriveLeft
116 | driveRight = oldDriveRight
117 |
118 | # save driveLeft and driveRight to oldDriveLeft and oldDriveRight
119 |
120 | oldDriveLeft = driveLeft
121 | oldDriveRight = driveRight
122 |
123 | # update motor values
124 |
125 | ZB.SetMotor2(-driveLeft * maxPower)
126 | ZB.SetMotor3(-driveLeft * maxPower)
127 | ZB.SetMotor1(-driveRight * maxPower)
128 | ZB.SetMotor4(-driveRight * maxPower)
129 |
130 |
--------------------------------------------------------------------------------
/microSD-saver.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
80 |
--------------------------------------------------------------------------------
/multiplex.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 |
3 | import smbus
4 |
5 | class multiplex:
6 |
7 | def __init__(self, bus):
8 | self.bus = smbus.SMBus(bus)
9 |
10 | def channel(self, address=0x70,channel=0): # values 0-3 indictae the channel, anything else (eg -1) turns off all channels
11 |
12 | if (channel==0): action = 0x01
13 | elif (channel==1): action = 0x02
14 | elif (channel==2): action = 0x04
15 | elif (channel==3): action = 0x08
16 | elif (channel==4): action = 0x10
17 | elif (channel==5): action = 0x20
18 | elif (channel==6): action = 0x40
19 | elif (channel==7): action = 0x80
20 | else : action = 0x00
21 |
22 | self.bus.write_byte_data(address,0x04,action) #0x04 is the register for switching channels
23 |
24 | if __name__ == '__main__':
25 |
26 | bus=1 # 0 for rev1 boards etc.
27 | address=0x70
28 |
29 | plexer = multiplex(bus)
30 | plexer.channel(address,2)
31 |
32 | print "Now run i2cdetect"
33 |
34 |
35 |
--------------------------------------------------------------------------------
/pseudo-drag.txt:
--------------------------------------------------------------------------------
1 | 1 pseudo code for straight-line speed test
2 | 2
3 | 3 while True
4 | 4 read sensor
5 | 5 if sensor return value is less than 10cm then turn left
6 | 6 if sensor returned value is greater than 15cm then turn right
7 | 7 sleep for 0.1 seconds
--------------------------------------------------------------------------------
/pseudo-maze.txt:
--------------------------------------------------------------------------------
1 | 1 pseudo code for reading destance sensor
2 | 2
3 | 3 listOfMoves = [ forward, right, forward, right, forward, left, forward, left, forward]
4 | 4
5 | 5 fuction turn(move)
6 | 6 if move equals 'left' then set left motors forwards and right motors backwards until turned 90 degrees
7 | 7 if move equals 'right' then set left motors backwards and right motors forwards until turned 90 degrees
8 | 8 if move equals 'forward' then set left motors forwards and right motors forwards
9 | 9
10 | 10 for nextMove in listOfMoves
11 | 11 read sensor
12 | 12 if sensor less than 10cm then turn(nextMove)
13 | 13 sleep for 0.1 seconds
14 |
--------------------------------------------------------------------------------
/zbJoystick.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Corteil/PiMag_Tiny_The_Robot/49027771fd967370937b79cc84bc5ef8c833f3ba/zbJoystick.py
--------------------------------------------------------------------------------