├── 3dprint └── stl │ ├── arch_x.stl │ ├── arch_y.stl │ ├── archadjustments.stl │ ├── boardmounts.stl │ ├── circuitplaygroundmount.stl │ ├── clip.stl │ ├── eye.stl │ ├── gimplebase.stl │ ├── gimplebase1.stl │ ├── gimplebase2.stl │ ├── piabaseonly.stl │ ├── piatoponly.stl │ ├── zaxis_bottom.stl │ ├── zaxis_pin.stl │ ├── zaxis_servomount.stl │ └── zaxis_top.stl ├── README.md ├── circuitplayground └── src │ ├── README.md │ ├── main.py │ ├── pia_cpx.py │ ├── pia_timer.py │ └── sounds │ ├── Dog Howling At Moon-SoundBible.com-1369876823.wav │ ├── bass_hit_c.wav │ ├── bd_tek.wav │ ├── bd_zome.wav │ ├── bring_out_your_dead-old1.wav │ ├── bring_out_your_dead.wav │ ├── comply_not.wav │ ├── drum_cowbell.wav │ ├── elec_blip2.wav │ ├── elec_cymbal.wav │ ├── elec_hi_snare.wav │ ├── for_no_man-old1.wav │ ├── for_no_man.wav │ ├── goodfellas_gangster-old1.wav │ ├── goodfellas_gangster.wav │ ├── heh_heh_heh.wav │ ├── hello.wav │ ├── laugh.wav │ ├── learned_lesson.wav │ ├── none_shall_pass.wav │ ├── not_good_time.wav │ ├── pee.wav │ ├── rimshot.wav │ ├── t2_learning_computer_x.wav │ ├── t2_terminator.wav │ ├── t3_cpu.wav │ └── yee_hah.wav ├── raspberry_pi ├── face_recognition │ └── haarcascade_frontalface_alt.xml ├── raspbian_img │ └── README.md └── src │ ├── pia.py │ ├── pia_pi_cpx.py │ ├── pia_servo.py │ └── test_talk_listen_to_circuitplayground.py └── sketchup └── pia26.skp /3dprint/stl/arch_x.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/arch_x.stl -------------------------------------------------------------------------------- /3dprint/stl/arch_y.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/arch_y.stl -------------------------------------------------------------------------------- /3dprint/stl/archadjustments.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/archadjustments.stl -------------------------------------------------------------------------------- /3dprint/stl/boardmounts.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/boardmounts.stl -------------------------------------------------------------------------------- /3dprint/stl/circuitplaygroundmount.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/circuitplaygroundmount.stl -------------------------------------------------------------------------------- /3dprint/stl/clip.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/clip.stl -------------------------------------------------------------------------------- /3dprint/stl/eye.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/eye.stl -------------------------------------------------------------------------------- /3dprint/stl/gimplebase.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/gimplebase.stl -------------------------------------------------------------------------------- /3dprint/stl/gimplebase1.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/gimplebase1.stl -------------------------------------------------------------------------------- /3dprint/stl/gimplebase2.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/gimplebase2.stl -------------------------------------------------------------------------------- /3dprint/stl/piabaseonly.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/piabaseonly.stl -------------------------------------------------------------------------------- /3dprint/stl/piatoponly.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/piatoponly.stl -------------------------------------------------------------------------------- /3dprint/stl/zaxis_bottom.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/zaxis_bottom.stl -------------------------------------------------------------------------------- /3dprint/stl/zaxis_pin.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/zaxis_pin.stl -------------------------------------------------------------------------------- /3dprint/stl/zaxis_servomount.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/zaxis_servomount.stl -------------------------------------------------------------------------------- /3dprint/stl/zaxis_top.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/3dprint/stl/zaxis_top.stl -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | "# pia-the-robot" 2 | 3 | https://www.youtube.com/watch?v=bRn4ZjMaChU 4 | 5 | This project was inspired by the youtube intereview between Pixar's Alonso Martinez and Sean with 'Tested'. 6 | 7 | Since I thought this was such a cool project, I decided to design my own and gather as much information from the video as I could. 8 | 9 | The little robot is head consists of 10 | 1) Two 3D printed concentric sphere shells using PLA plastic. 11 | 2) 3 small servos ($6.00 each) 12 | 3) 3D printed gimble system 13 | 4) A raspberry pi 3 (or Pi zero) and camera ($35 + $30) 14 | 5) Adafruit's 16-Channel 12-bit PWM/Servo Driver ($15) 15 | 5) Adafruit's Circuit Playground Express (because it has a lot of sensors, NeoPixels, speaker, sound sensor, light sensor, termistor (Temperature sensor), Motion Sensor, Infrared receiver/transmittor) and more on a 2" cicular board for $25.00 16 | 17 | Included in this project are: 18 | 1) The complete Trimble SketchUp model I designed 19 | 2) The STL generated from the SketchUp model for printing on a 3D printer 20 | 3) The python and Circuit Python code that was written to run on the raspberry pi and Circuit Playground Express. 21 | 4) * Diagrams how to wire this up. 22 | 5) * A drive image (*.img) containing the latest raspbian OS, all installed dependencies including OpenCV used for the image/face recongnition. 23 | 24 | * Not ready yet. -------------------------------------------------------------------------------- /circuitplayground/src/README.md: -------------------------------------------------------------------------------- 1 | the contents here need to be placed in the main directory of the circuitplayground express -------------------------------------------------------------------------------- /circuitplayground/src/main.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | * This file is part of the Pia-the-robot project, 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2018 Jim Gabriel 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | """ 27 | from pia_cpx import Pia 28 | from pia_timer import Timer 29 | 30 | pia = Pia() 31 | timer = Timer() #create a timer that keeps track of a elapsedTime 32 | print ('running pia for the circuit playground express.. waiting for serial commands from raspberry pi') 33 | 34 | pia.flash_all_pixels(None, 20) 35 | while True: 36 | 37 | #pia.has_been_touched(padtouched = "any") 38 | if pia.has_been_touched(padtouched = pia._cpx.touch_A1) : 39 | print('you touched it baby') 40 | 41 | pia.get_command() 42 | pia.run_commands() 43 | 44 | if timer.getElapsedTime() > 60 : #Check every 60 seconds to check the temperature 45 | temperature = pia.temperature('F') 46 | timer.reset() 47 | if temperature: 48 | pia.set_command('it is ' + temperature) 49 | 50 | 51 | -------------------------------------------------------------------------------- /circuitplayground/src/pia_cpx.py: -------------------------------------------------------------------------------- 1 | """ 2 | * This file is part of the Pia-the-robot project, 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2018 Jim Gabriel 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | """ 26 | import time 27 | import random 28 | import board 29 | import digitalio 30 | import busio 31 | 32 | from adafruit_circuitplayground.express import cpx 33 | 34 | # https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/master/adafruit_circuitplayground/express.py 35 | 36 | # Configuration: 37 | audiofiles = ["sounds/laugh.wav", 38 | "sounds/comply_not.wav", 39 | "sounds/t2_learning_computer_x.wav", 40 | 41 | "sounds/bd_zome.wav", 42 | "sounds/bd_tek.wav", 43 | "sounds/drum_cowbell.wav", 44 | "sounds/elec_blip2.wav", 45 | "sounds/elec_cymbal.wav", 46 | "sounds/elec_hi_snare.wav", 47 | "sounds/t2_terminator.wav", 48 | "sounds/none_shall_pass.wav", 49 | "sounds/hello.wav", 50 | "sounds/heh_heh_heh.wav", 51 | "sounds/for_no_man.wav", 52 | "sounds/bring_out_your_dead.wav", 53 | "sounds/yee_hah.wav", 54 | 55 | "sounds/learned_lesson.wav", 56 | "sounds/pee.wav", 57 | "sounds/goodfellas_gangster.wav" 58 | ] 59 | 60 | class Pia (): 61 | def __init__(self, decay=0.5): 62 | self._cpx = cpx 63 | self._uart = busio.UART(board.TX, board.RX, baudrate=9600) 64 | self._commands = [] 65 | 66 | def getRandomColor (self): 67 | return (random.randint(0,16), random.randint(0,16), random.randint(0,16)) 68 | 69 | def play_file(self, filename): 70 | #print("playing file " + filename) 71 | self._cpx.play_file(filename) 72 | 73 | def giggle(self) : 74 | self.play_file( audiofiles[0]) 75 | 76 | def run_commands(self): 77 | while len(self._commands) > 0 : 78 | cmd = self._commands.pop(0) 79 | try: 80 | pia_command = getattr(self, cmd) 81 | pia_command() 82 | print('running cmd:' + str(cmd)) 83 | except: 84 | print ('unknown command') 85 | return 86 | 87 | def set_command(self, cmd_string = None) : 88 | btyeswritten = 0 89 | if cmd_string is not None: 90 | btyeswritten = self._uart.write(cmd_string + '\n') 91 | #print ('bytes written %d'%btyeswritten) 92 | 93 | def get_command(self) : 94 | cmd = self._uart.readline() # read up to 32 byte 95 | if cmd is not None: 96 | cmd_string = ''.join([chr(b) for b in cmd]) 97 | self._commands.append(cmd_string) # lets add the command to the queue in perparation to be run 98 | 99 | def i_will_not_comply(self) : 100 | self.play_file( audiofiles[1]) 101 | 102 | def has_been_shaken (self): 103 | if self._cpx.shake(shake_threshold=10): 104 | #print ("I've been shaken!") 105 | self.flash_all_pixels() 106 | try: 107 | idx = random.randint(0,len(audiofiles)-1) 108 | self.play_file( audiofiles[idx]) 109 | except: 110 | pass 111 | #print ('opps: ' + audiofiles[idx]) 112 | 113 | def wheel(self, pos): 114 | # Input a value 0 to 255 to get a color value. 115 | # The colours are a transition r - g - b - back to r. 116 | if (pos < 0) or (pos > 255): 117 | return (0, 0, 0) 118 | if pos < 85: 119 | return (int(pos * 3), int(255 - (pos*3)), 0) 120 | elif pos < 170: 121 | pos -= 85 122 | return (int(255 - pos*3), 0, int(pos*3)) 123 | #else: 124 | pos -= 170 125 | return (0, int(pos*3), int(255 - pos*3)) 126 | 127 | def rainbow_cycle(self, wait): 128 | self._cpx.pixels.auto_write = False 129 | self._cpx.pixels.brightness = 0.3 130 | for j in range(255): 131 | for led in range(self._cpx.pixels.n): 132 | idx = int((led * 256 / len(self._cpx.pixels)) + j) 133 | self._cpx.pixels[led] = self.wheel(idx & 255) 134 | self._cpx.pixels.show() 135 | time.sleep(wait) 136 | 137 | def flash_all_pixels (self, definedColor = None, loopcount=6): 138 | #self.rainbow_cycle(0.001) 139 | self._cpx.pixels.brightness = 1 140 | for loop in range (loopcount): 141 | for led in range(10): 142 | if definedColor == None: 143 | self._cpx.pixels[led] = self.getRandomColor() 144 | else: 145 | self._cpx.pixels[led] = definedColor 146 | 147 | #self.rainbow_cycle(0.001) 148 | time.sleep(0.02) 149 | self._cpx.pixels[led] = 0x000000 #turn the pixel off 150 | 151 | def has_been_touched(self, padtouched = "any"): 152 | rtn = False 153 | if ((padtouched == "any") and 154 | ((self._cpx.touch_A1) or 155 | (self._cpx.touch_A2) or 156 | (self._cpx.touch_A3) or 157 | (self._cpx.touch_A4) or 158 | (self._cpx.touch_A5) or 159 | (self._cpx.touch_A6) or 160 | (self._cpx.touch_A7) 161 | )) or ((padtouched != "any") and padtouched) : 162 | self.giggle() 163 | rtn = True 164 | return rtn 165 | 166 | 167 | def temperature(self, _degrees_in = 'f'): 168 | temperature_c = self._cpx.temperature 169 | rtn = str(temperature_c) + ' degrees C' 170 | if _degrees_in in ['f', 'F'] : 171 | temperature_f = temperature_c * 1.8 + 32 172 | print("Temperature fahrenheit:", temperature_f) 173 | rtn = str(temperature_f) + ' degrees F' 174 | if temperature_f > 86 : 175 | self.flash_all_pixels ( definedColor = (16, 0, 0), loopcount = 1 ) #red hot 176 | else: 177 | if temperature_f < 60 : 178 | self.flash_all_pixels ( definedColor = (0, 0, 16), loopcount = 1 ) #blue 179 | else: 180 | print("Temperature celsius:", temperature_c) 181 | if temperature_c > 30 : 182 | self.flash_all_pixels ( definedColor= (16, 0, 0) , loopcount = 1) #red hot 183 | return rtn 184 | -------------------------------------------------------------------------------- /circuitplayground/src/pia_timer.py: -------------------------------------------------------------------------------- 1 | """ 2 | * This file is part of the Pia-the-robot project, 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2018 Jim Gabriel 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | """ 26 | 27 | import time 28 | 29 | """ 30 | Timer class will keep track of elasped time. 31 | * Use the getElapedTime() method to retreive the number of seconds that have elasped since it was started 32 | * Use the reset() to reset the elapsed time 33 | 34 | """ 35 | class Timer(): 36 | 37 | def __init__ (self): 38 | self.start = time.monotonic() 39 | 40 | def getElapsedTime (self) : 41 | self.stop = time.monotonic() 42 | return self.stop - self.start 43 | 44 | def reset (self) : 45 | self.start = time.monotonic() -------------------------------------------------------------------------------- /circuitplayground/src/sounds/Dog Howling At Moon-SoundBible.com-1369876823.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/Dog Howling At Moon-SoundBible.com-1369876823.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/bass_hit_c.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/bass_hit_c.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/bd_tek.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/bd_tek.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/bd_zome.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/bd_zome.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/bring_out_your_dead-old1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/bring_out_your_dead-old1.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/bring_out_your_dead.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/bring_out_your_dead.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/comply_not.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/comply_not.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/drum_cowbell.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/drum_cowbell.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/elec_blip2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/elec_blip2.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/elec_cymbal.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/elec_cymbal.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/elec_hi_snare.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/elec_hi_snare.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/for_no_man-old1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/for_no_man-old1.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/for_no_man.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/for_no_man.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/goodfellas_gangster-old1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/goodfellas_gangster-old1.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/goodfellas_gangster.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/goodfellas_gangster.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/heh_heh_heh.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/heh_heh_heh.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/hello.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/hello.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/laugh.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/laugh.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/learned_lesson.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/learned_lesson.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/none_shall_pass.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/none_shall_pass.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/not_good_time.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/not_good_time.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/pee.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/pee.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/rimshot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/rimshot.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/t2_learning_computer_x.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/t2_learning_computer_x.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/t2_terminator.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/t2_terminator.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/t3_cpu.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/t3_cpu.wav -------------------------------------------------------------------------------- /circuitplayground/src/sounds/yee_hah.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/circuitplayground/src/sounds/yee_hah.wav -------------------------------------------------------------------------------- /raspberry_pi/raspbian_img/README.md: -------------------------------------------------------------------------------- 1 | I will provide a read-to-use raspbian image here -------------------------------------------------------------------------------- /raspberry_pi/src/pia.py: -------------------------------------------------------------------------------- 1 | """ 2 | * This file is part of the Pia-the-robot project, 3 | * 4 | * The MIT License (MIT) 5 | * 6 | * Copyright (c) 2018 Jim Gabriel 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | """ 26 | 27 | from __future__ import division 28 | from pia_servo import Servo 29 | from pia_pi_cpx import Pi_CPX 30 | import time 31 | import sys 32 | 33 | 34 | def moveServos (servolist): 35 | print ('running ' + `len(servolist)`) 36 | for loop in range(10) : 37 | for servo in servolist: 38 | print (servo.alias) 39 | if (loop < 30) or (servo.channel==2): 40 | servo.goMiniDelta() 41 | time.sleep(0.05) 42 | return 43 | 44 | print('Moving servo on channel 0, press Ctrl-C to quit...') 45 | pia_cpx = Pi_CPX () # create the object for communicating with the circuit playground express 46 | 47 | 48 | xServo= Servo(0,'xServo', _zero = 101) 49 | yServo= Servo(1,'yServo', _zero = 101) 50 | zServo= Servo(2,'zServo', _zero = 90) 51 | 52 | #xServo.reset() 53 | #yServo.reset() 54 | xServo.setPauseWhenDone(2) 55 | xServo.setSpeedStep(1) 56 | xServo.setSleepDelay(0.01) 57 | xServo.reset() 58 | 59 | yServo.setPauseWhenDone(2) 60 | yServo.setSpeedStep(1) 61 | yServo.setSleepDelay(0.01) 62 | yServo.reset() 63 | 64 | zServo.setPauseWhenDone(2) 65 | zServo.setSpeedStep(1) 66 | zServo.setSleepDelay(0.01) 67 | zServo.reset() 68 | 69 | 70 | 71 | print('Moving servo on channel 0, press Ctrl-C to quit...') 72 | while True: 73 | xServo.setDegrees('+10') 74 | xServo.go() 75 | 76 | pia_cpx.send('i_will_not_comply') 77 | 78 | 79 | yServo.setDegrees('+20') 80 | yServo.go() 81 | 82 | xServo.setDegrees('-10') 83 | xServo.go() 84 | 85 | zServo.setDegrees('+15') 86 | zServo.go() 87 | pia_cpx.send('flash_all_pixels') 88 | 89 | yServo.setDegrees('-20') 90 | yServo.go() 91 | 92 | zServo.setDegrees('+30') 93 | zServo.go() 94 | 95 | pia_cpx.send('flash_all_pixels') 96 | zServo.setDegrees('-90') 97 | zServo.go() 98 | 99 | zServo.setDegrees('+45') 100 | zServo.go() 101 | 102 | cpx_message = pia_cpx.receive() 103 | if cpx_message: 104 | print (cpx_message) 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /raspberry_pi/src/pia_pi_cpx.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | * This file is part of the Pia-the-robot project, 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2018 Jim Gabriel 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | """ 27 | # The purpose of this class provides serial communcion with the CircuitPlayground Express 28 | 29 | import serial 30 | class Pi_CPX: 31 | def __init__(self, myport = '/dev/ttyAMA0' ): 32 | self._ser = serial.Serial( 33 | port= myport, 34 | baudrate = 9600, 35 | parity=serial.PARITY_NONE, 36 | stopbits=serial.STOPBITS_ONE, 37 | bytesize=serial.EIGHTBITS, 38 | timeout=1 39 | ) 40 | self._active = self._ser.isOpen() 41 | 42 | # this will send method calls to the circuitplayground to run 43 | # example "i_will_not_comply" 44 | # " 45 | def send (self, cmd_methodname = ''): 46 | if self._active and (cmd_methodname != '') : 47 | byteswritten = self._ser.write(cmd_methodname) #send the command to the circuitplayground 48 | print ("wrote %d bytes to serial port" % ( byteswritten) + '\n' ) 49 | 50 | def receive (self): 51 | receiveddata = self._ser.readline() 52 | if receiveddata : # the circuit playground sais something back 53 | print ("read successful %d"%(len(receiveddata)) + ' read this: ' + receiveddata + '\n') 54 | return receiveddata 55 | -------------------------------------------------------------------------------- /raspberry_pi/src/pia_servo.py: -------------------------------------------------------------------------------- 1 | # pia_servo for the PCA9685 PWM servo/LED controller library. 2 | 3 | """ 4 | * This file is part of the Pia-the-robot project, 5 | * 6 | * The MIT License (MIT) 7 | * 8 | * Copyright (c) 2018 Jim Gabriel 9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, and to permit persons to whom the Software is 15 | * furnished to do so, subject to the following conditions: 16 | * 17 | * The above copyright notice and this permission notice shall be included in 18 | * all copies or substantial portions of the Software. 19 | * 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | * THE SOFTWARE. 27 | """ 28 | from __future__ import division 29 | import time 30 | import sys 31 | 32 | import Adafruit_PCA9685 33 | 34 | def map( degrees, in_min, in_max, out_min, out_max) : 35 | return int ((degrees - in_min) * (out_max - out_min) / (in_max - in_min) + out_min) 36 | 37 | class Servo: 38 | servo_min = 150 # 150 # Min pulse length out of 4096 39 | servo_max = 600 # 600 # Max pulse length out of 4096 40 | 41 | maxposition = 70 #70 #degrees 42 | minpostion = 140 #degress 43 | 44 | delay = 0.1 45 | currentpos = 0 46 | channel = 1 47 | 48 | def __init__(self, _channel=0, _alias="", _zero=101, _step=1): 49 | self.channel = _channel 50 | self.alias = _alias 51 | self.sleepdelay = 0.008 #sleep in between steps 52 | self.pausewhendone = 1 #after the final move, then pause this much 53 | self.deltadegrees = 0 54 | self.degrees = _zero 55 | self.zero = _zero 56 | self.currentpos = _zero 57 | self.step = _step 58 | self.pwm = Adafruit_PCA9685.PCA9685() 59 | self.pwm.set_pwm_freq(60) 60 | 61 | def setPauseWhenDone( self, _pause ): 62 | self.pausewhendone = _pause 63 | 64 | def setSpeedStep (self, _step): 65 | self.step = _step 66 | 67 | def setSleepDelay (self, _sleepdelay): 68 | self.sleepdelay = _sleepdelay 69 | 70 | def setDegrees (self, _degrees): 71 | if _degrees [:1] in ['+', '-'] : 72 | #print ('1 going delta ' + `_degrees` + ' deltadegrees:' + `self.deltadegrees` + ' degreees:' + `self.degrees` ) 73 | self.deltadegrees = int (_degrees) 74 | self.degrees += int(_degrees) 75 | #print ('2 going delta ' + `_degrees` + ' deltadegrees:' + `self.deltadegrees` + ' degreees:' + `self.degrees` ) 76 | else: 77 | self.deltadegrees = 0 78 | self.degrees = int(_degrees) 79 | #print ('going ' + `self.degrees`) 80 | 81 | def go (self): 82 | direction = 1 83 | if self.currentpos > self.degrees : 84 | direction = -1 85 | direction = direction * self.step 86 | print ('going from ' + `self.currentpos` + ' to ' + `self.degrees` + ' by ' + `direction` ) 87 | for degree in range(self.currentpos, self.degrees, direction) : 88 | #print ('***>' +`degree`) 89 | self.pwm.set_pwm(self.channel, 0, map(degree, 0, 180, self.servo_min, self.servo_max)) 90 | time.sleep(self.sleepdelay) 91 | self.currentpos = self.degrees 92 | #print (self.alias + ' now @ ' + `self.currentpos`) 93 | time.sleep(self.pausewhendone) 94 | 95 | 96 | def goMiniDelta(self): 97 | direction = 1 98 | if self.deltadegrees < 0 : 99 | direction = -1 100 | 101 | direction = self.step * direction 102 | degree = self.currentpos + direction 103 | 104 | self.pwm.set_pwm(self.channel, 0, map(degree, 0, 180, self.servo_min, self.servo_max)) 105 | time.sleep(self.sleepdelay) 106 | self.currentpos = degree 107 | 108 | 109 | def goDelta (self): 110 | direction = 1 111 | if self.deltadegrees < 0 : 112 | direction = -1 113 | 114 | direction = self.step * direction 115 | 116 | #print ('currentpos: ' + `self.currentpos` + ' moving to: ' + `self.currentpos + self.deltadegrees` + ' direction = ' + `direction` ) 117 | for degree in range(self.currentpos, self.currentpos + self.deltadegrees, direction) : 118 | self.pwm.set_pwm(self.channel, 0, map(degree, 0, 180, self.servo_min, self.servo_max)) 119 | time.sleep(self.sleepdelay) 120 | 121 | self.currentpos = self.currentpos + self.deltadegrees 122 | #print (self.alias + ' now @ ' + `self.currentpos`) 123 | print ('') 124 | 125 | def reset(self): 126 | print ("resetting " + self.alias + ' to zero ' + `self.servo_min` + ' ' + `self.servo_max`) 127 | #zero = map(self.zero, 0, 180, self.servo_min, self.servo_max) 128 | #self.setDegrees (`zero`) 129 | #self.setSpeedStep(1) 130 | #self.setSleepDelay(0.01) 131 | #self.go() 132 | 133 | self.pwm.set_pwm(self.channel, 0, map(self.zero, 0, 180, self.servo_min, self.servo_max)) 134 | 135 | 136 | -------------------------------------------------------------------------------- /raspberry_pi/src/test_talk_listen_to_circuitplayground.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """ 3 | * This file is part of the Pia-the-robot project, 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2018 Jim Gabriel 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | """ 27 | # 28 | # the purpose of this is just to test the commmunication is working between the PI and the Circuitplayground express. 29 | # commands (i.e. object method names) can be sent to the circuitplayground over the serial port 30 | import time 31 | import serial 32 | 33 | myport = '/dev/ttyAMA0' 34 | ser = serial.Serial( 35 | port= myport, 36 | baudrate = 9600, 37 | parity=serial.PARITY_NONE, 38 | stopbits=serial.STOPBITS_ONE, 39 | bytesize=serial.EIGHTBITS, 40 | timeout=1 41 | ) 42 | 43 | if ser.isOpen() : 44 | print ('started') 45 | counter=0 46 | while True: 47 | cmd_methodname = "i_will_not_comply" 48 | #cmd_methodname = "giggle" 49 | #cmd_methodname = "flash_all_pixels" 50 | try: 51 | byteswritten = ser.write(cmd_methodname) #send the command to the circuitplayground 52 | print ("wrote %d bytes to serial port" % ( byteswritten) + '\n' ) 53 | 54 | data = ser.readline() 55 | if data : # the circuit playground sais something back 56 | print ("read successful %d"%(len(data)) + ' read this: ' + data + '\n') 57 | except Exception, e: 58 | print ("error writing to serial port" + str(e)) 59 | 60 | time.sleep(1) 61 | counter += 1 62 | -------------------------------------------------------------------------------- /sketchup/pia26.skp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BtreeComputingServcies/pia-the-robot/06942474c523571358704dd1258fcf849e591640/sketchup/pia26.skp --------------------------------------------------------------------------------