├── .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 | 19 | 21 | 44 | 46 | 47 | 49 | image/svg+xml 50 | 52 | 53 | 54 | 55 | 56 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 175 | 180 | 185 | 190 | 195 | 200 | 205 | 210 | 215 | 220 | 225 | 230 | 235 | 240 | 245 | 250 | 255 | 260 | 265 | 270 | 275 | 280 | 285 | 290 | 295 | 300 | 305 | 310 | 315 | 320 | 325 | 330 | 335 | 340 | 345 | 350 | 355 | 360 | 365 | 370 | 375 | 380 | 385 | 390 | 395 | 400 | 405 | 410 | 415 | 420 | 425 | 430 | 435 | 440 | 445 | 450 | 455 | 460 | 465 | 470 | 475 | 480 | 485 | 490 | 495 | 500 | 505 | 510 | 515 | 520 | 525 | 530 | 535 | 540 | 545 | 550 | 555 | 560 | 565 | 570 | 575 | 580 | 585 | 590 | 595 | 600 | 605 | 610 | 615 | 620 | 625 | 630 | 635 | 640 | 645 | 650 | 655 | 660 | 665 | 670 | 675 | 680 | 685 | 690 | 695 | 700 | 705 | 710 | 715 | 720 | 725 | 730 | 735 | 740 | 745 | 750 | 755 | 760 | 765 | 770 | 775 | 780 | 785 | 790 | 795 | 800 | 805 | 810 | 815 | 820 | 825 | 830 | 835 | 840 | 845 | 850 | 855 | 860 | 865 | 870 | 875 | 880 | 885 | 890 | 895 | 900 | 905 | 910 | 915 | 920 | 925 | 930 | 935 | 940 | 945 | 949 | 953 | 958 | 959 | 960 | -------------------------------------------------------------------------------- /MagPi-Tiny-The-Robot-version-1.6.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 44 | 46 | 47 | 49 | image/svg+xml 50 | 52 | 53 | 54 | 55 | 56 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 175 | 180 | 185 | 190 | 195 | 200 | 205 | 210 | 215 | 220 | 225 | 230 | 235 | 240 | 245 | 250 | 255 | 260 | 265 | 270 | 275 | 280 | 285 | 290 | 295 | 300 | 305 | 310 | 315 | 320 | 325 | 330 | 335 | 340 | 345 | 350 | 355 | 360 | 365 | 370 | 375 | 380 | 385 | 390 | 395 | 400 | 405 | 410 | 415 | 420 | 425 | 430 | 435 | 440 | 445 | 450 | 455 | 460 | 465 | 470 | 475 | 480 | 485 | 490 | 495 | 500 | 505 | 510 | 515 | 520 | 525 | 530 | 535 | 540 | 545 | 550 | 555 | 560 | 565 | 570 | 575 | 580 | 585 | 590 | 595 | 600 | 605 | 610 | 615 | 620 | 625 | 630 | 635 | 640 | 645 | 650 | 655 | 660 | 665 | 670 | 675 | 680 | 685 | 690 | 695 | 699 | 703 | 708 | 713 | 718 | 723 | 728 | 733 | 738 | 743 | 748 | 753 | 758 | 763 | 768 | 773 | 778 | 783 | 788 | 793 | 798 | 803 | 808 | 813 | 818 | 823 | 828 | 833 | 838 | 843 | 848 | 853 | 858 | 863 | 868 | 873 | 878 | 883 | 888 | 893 | 898 | 903 | 908 | 913 | 918 | 923 | 928 | 933 | 938 | 943 | 948 | 953 | 958 | 963 | 968 | 973 | 978 | 983 | 988 | 993 | 998 | 999 | 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 | 19 | 21 | 29 | 34 | 35 | 36 | 62 | 64 | 65 | 67 | image/svg+xml 68 | 70 | 71 | 72 | 73 | 74 | 79 | 83 | 87 | 92 | 97 | 98 | 102 | 107 | 112 | 113 | 118 | 123 | 128 | 132 | 137 | 142 | 147 | 152 | 153 | 158 | 163 | 168 | 173 | 177 | 182 | 187 | 188 | 192 | 197 | 202 | 203 | 208 | 213 | 218 | 223 | 228 | 233 | 237 | 241 | 246 | 251 | 256 | 261 | 262 | 263 | 267 | 272 | 277 | 281 | 286 | 291 | 296 | 301 | 302 | 307 | 312 | 317 | 322 | 327 | 331 | 334 | 337 | 342 | 346 | 350 | 354 | 358 | 362 | 366 | 370 | 374 | 378 | 382 | 386 | 390 | 394 | 398 | 402 | 406 | 410 | 414 | 418 | 422 | 426 | 430 | 434 | 438 | 442 | 446 | 450 | 454 | 458 | 462 | 466 | 470 | 474 | 478 | 482 | 486 | 490 | 494 | 498 | 502 | 506 | 510 | 514 | 518 | 522 | 523 | 527 | 531 | 535 | 539 | 543 | 547 | 551 | 555 | 559 | 563 | 567 | 571 | 575 | 579 | 583 | 587 | 591 | 595 | 599 | 603 | 607 | 611 | 615 | 619 | 623 | 627 | 631 | 635 | 639 | 643 | 647 | 651 | 655 | 659 | 663 | 667 | 671 | 675 | 679 | 683 | 687 | 691 | 695 | 699 | 703 | 707 | 711 | 715 | 719 | 723 | 727 | 731 | 735 | 739 | 743 | 747 | 751 | 755 | 759 | 763 | 767 | 771 | 775 | 779 | 783 | 787 | 788 | 792 | 793 | 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 | 20 | 22 | 23 | 25 | image/svg+xml 26 | 28 | 29 | 30 | 31 | 32 | 34 | 55 | 58 | 59 | 64 | 65 | 71 | 72 | 78 | 79 | 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 --------------------------------------------------------------------------------