Skip to content

Commit

Permalink
Merge pull request #3 from adamb314/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
adamb314 authored Mar 11, 2022
2 parents ef79eea + 02fe10e commit cc4bba9
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 143 deletions.
56 changes: 52 additions & 4 deletions ArduinoSketch/configurationWizard.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/python3
import os
import sys
import sysconfig
import re
import subprocess

def setWorkingDirToScriptDir():
Expand All @@ -10,6 +12,9 @@ def setWorkingDirToScriptDir():

sys.path.insert(1, '../Python')

def isMingwPlatform():
return os.name == "nt" and sysconfig.get_platform().startswith("mingw")

def checkPip():
try:
out = subprocess.check_output([sys.executable, "-m", "pip"])
Expand All @@ -20,6 +25,12 @@ def checkPip():
return False

def install(package):
if isMingwPlatform():
return installWithPacman(package)

return installWithPip(package)

def installWithPip(package):
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", package])
return True
Expand All @@ -28,6 +39,36 @@ def install(package):

return False

pacmanPythonPackageName = None
def getPacmanPythonPackage():
global pacmanPythonPackageName
if pacmanPythonPackageName:
return pacmanPythonPackageName

print('Looking for python package name with "pacman -Q"...')

out = subprocess.check_output(["pacman", "-Q"])
string = out.decode("utf-8")
findPythonPattern = re.compile(r'(?P<pythonPackage>[^\s]+-python)\s')
maches = findPythonPattern.finditer(string)

for m in maches:
pacmanPythonPackageName = m.group("pythonPackage")

return pacmanPythonPackageName

def installWithPacman(package):
try:
getPacmanPythonPackage()
package = f'{getPacmanPythonPackage()}-{package}'
subprocess.check_call(["pacman", "-S", "--noconfirm", package])
print('')
return True
except Exception as e:
pass

return False

def getPackageData(missingPackage):
dic = {
'serial' : ('pyserial', True),
Expand All @@ -42,6 +83,7 @@ def getPackageData(missingPackage):
def main():
setWorkingDirToScriptDir()

lastMissingPackage = None
while True:
missingPackage = None
try:
Expand Down Expand Up @@ -69,20 +111,26 @@ def main():
if not missingPackage:
break

if not checkPip():
print(f'Could not find python pip. Please install pip manually')
if missingPackage == lastMissingPackage:
print(f'Please restart script to complete install')
break

missingPackageData = getPackageData(missingPackage)

if not isMingwPlatform() and not checkPip():
print(f'Could not find python pip. Please install pip manually')
break

if missingPackageData[1]:
ans = input(f'Missing dependency "{missingPackageData[0]}". Install with pip? (y/N)?')
ans = input(f'Missing dependency "{missingPackageData[0]}". Install? (y/N)?')
if ans.find('Y') != 0 and ans.find('y') != 0:
break

if not install(missingPackageData[0]):
print(f'Could not install "{missingPackageData[0]}" with pip. Please fix dependency manually!')
print(f'Could not install "{missingPackageData[0]}". Please fix dependency manually!')
break

lastMissingPackage = missingPackage
else:
print(f'Please fix missing dependency "{missingPackageData[0]}" manually!')
break
Expand Down
24 changes: 24 additions & 0 deletions Doc/BuildInstructionsBrushedServo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Brushed servo modification (DS3225 MG)
--------

### Part list

* 1 x DS3225 MG servo
* 1 x Custom PCB
* PcbDesignes/ServoBrushed/combined/manufacture
* 2 x ITR8307

Cad and stl files for 3D printing:
```
CadFiles/ServoBrushed
```

Electrical schematic:
```
PcbDesignes/ServoBrushed
```

### Build instructions

[<img width="500px" src="readmeResources/VideoTutorialImage.png">](https://youtu.be/ECLrLupFW10?t=94)
[Video Tutorial](https://youtu.be/ECLrLupFW10?t=94)
79 changes: 79 additions & 0 deletions Doc/BuildInstructionsCorelessServo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Coreless servo modification (Turnigy MG959)
--------

### Part list

* 1 x Turnigy MG959 servo
* 1 x Adafruit ItsyBitsy M0 Express
* https://learn.adafruit.com/introducing-itsy-bitsy-m0
* 1 x SparkFun Motor Driver - Dual TB6612FNG (1A)
* https://www.sparkfun.com/products/14451
* 1 x as5048A + 6mm x 2mm comopatible magnet
* https://ams.com/as5048a
* 2 x ITR8307
* 2 x 8.2 kohm resistor
* 2 x 120 ohm resistor

Cad and stl files for 3D printing:
```
CadFiles/ServoCoreless
```

Electrical schematic:
```
PcbDesignes/ServoCoreless
```
### Build instructions

#### Build MainPcb and AS5048aEncoderBoard

A video on how to build the MainPcb and AS5048aEncoderBoard can be found at https://youtu.be/YQpAAr5RPSE?t=60.
This video is for an older version but the building instructions are the same.

#### Servo gearbox with 3D printed parts

| <img width="500px" src="readmeResources/fullSizeServo/parts2.png"> |
| --- |

#### PCB Assemblies

| <img width="500px" src="readmeResources/fullSizeServo/parts1.png"> |
| --- |

#### How to mount the PCBs to servo

| <img width="500px" src="readmeResources/fullSizeServo/parts3.jpg"> | <img width="500px" src="readmeResources/fullSizeServo/parts4.jpg"> |
| --- | --- |

| <img width="500px" src="readmeResources/fullSizeServo/parts5.jpg"> | <img width="500px" src="readmeResources/fullSizeServo/parts6.jpg"> |
| --- | --- |

#### Build the Optical Encoder

| <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step1.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step2.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step3.jpg"> |
| --- | --- | --- |

1) Take the motor, use pliers to bend out the four indents in the metal housing and bend up the motor lid.

| <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step4.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step5_1.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step5_2.jpg"> |
| --- | --- | --- |

2) Remove the two steel brushes from the lid carefully by cutting the lid into pieces. Take the 3D printed motor lid and insert the two steel brushes and two ITR8307 into the new lid. Solder the ITR8307 according to:
```
PcbDesignes/Servo/OpticalEncoder/OpticalEncoder.sch
```

| <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step6_1.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step6_2.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step7.jpg"> |
| --- | --- | --- |

3) Take the motor with the lid removed. Paint the rotor with black nail polish and glue in the optical encoder wheel on top as shown in the middle image. The dimensions of the encoder wheel can be found in:
```
CadFiles/Servo/OpticalEncoderWheelDimensions.png
```
Then carefully put the new lid on the motor without bending the steel brushes.

| <img width="500px" src="readmeResources/fullSizeServo/OptEncBuild/step8.jpg"> |
| --- |

4) Solder the four leads from the optical encoder on top of ItsyBitsy board as shown in this image.
116 changes: 4 additions & 112 deletions Doc/BuildInstructions.md → Doc/BuildInstructionsMicroServo.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
# Build instructions

Hardware
Micro servo modification (MG90S or SG90)
--------

### Parts list

#### Modified coreless servo
* 1 x Turnigy MG959 servo
* 1 x Adafruit ItsyBitsy M0 Express
* https://learn.adafruit.com/introducing-itsy-bitsy-m0
* 1 x SparkFun Motor Driver - Dual TB6612FNG (1A)
* https://www.sparkfun.com/products/14451
* 1 x as5048A + 6mm x 2mm comopatible magnet
* https://ams.com/as5048a
* 2 x ITR8307
* 2 x 8.2 kohm resistor
* 2 x 120 ohm resistor
### Part list

Cad and stl files for 3D printing:
```
CadFiles/ServoCoreless
```

Electrical schematic:
```
PcbDesignes/ServoCoreless
```

#### Modified micro servo
* 1 x MG90S servo
* 1 x Adafruit ItsyBitsy M0 Express
* https://learn.adafruit.com/introducing-itsy-bitsy-m0
Expand All @@ -48,90 +23,7 @@ Electrical schematic:
PcbDesignes/MicroServo
```

#### Gripper
* 1 x SG90 servo

".stl" files for 3D printing:
```
CadFiles/Robot/stl/GripperBase.stl
CadFiles/Robot/stl/GripperClip.stl
CadFiles/Robot/stl/GripperFinger1.stl
CadFiles/Robot/stl/GripperFinger2.stl
CadFiles/Robot/stl/GripperMount.stl
```

#### Robot
* 3 x Modified coreless servo
* 3 x Modified micro servo
* 1 x Gripper
* 1 x 10 x 10 mm square aluminum bar (about 500 mm)
* 1 x 15 x 15 mm square aluminum bar (about 100 mm)
* 1 x 5V Powersuply
* 1 x Fast USB to serial microcontroller (Adafruit ItsyBitsy M0 Express or Arduino MKR Zero)
* https://learn.adafruit.com/introducing-itsy-bitsy-m0
* https://store.arduino.cc/arduino-mkr-zero-i2s-bus-sd-for-sound-music-digital-audio-data

Cad and stl files for 3D printing:
```
CadFiles/Robot
```

## Coreless servo modification (Turnigy MG959)

#### Build MainPcb and AS5048aEncoderBoard

A video on how to build the MainPcb and AS5048aEncoderBoard can be found at https://youtu.be/YQpAAr5RPSE?t=60.
This video is for an older version but the building instructions are the same.

#### Servo gearbox with 3D printed parts

| <img width="500px" src="readmeResources/fullSizeServo/parts2.png"> |
| --- |

#### PCB Assemblies

| <img width="500px" src="readmeResources/fullSizeServo/parts1.png"> |
| --- |

#### How to mount the PCBs to servo

| <img width="500px" src="readmeResources/fullSizeServo/parts3.jpg"> | <img width="500px" src="readmeResources/fullSizeServo/parts4.jpg"> |
| --- | --- |

| <img width="500px" src="readmeResources/fullSizeServo/parts5.jpg"> | <img width="500px" src="readmeResources/fullSizeServo/parts6.jpg"> |
| --- | --- |

#### Build the Optical Encoder

| <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step1.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step2.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step3.jpg"> |
| --- | --- | --- |

1) Take the motor, use pliers to bend out the four indents in the metal housing and bend up the motor lid.

| <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step4.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step5_1.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step5_2.jpg"> |
| --- | --- | --- |

2) Remove the two steel brushes from the lid carefully by cutting the lid into pieces. Take the 3D printed motor lid and insert the two steel brushes and two ITR8307 into the new lid. Solder the ITR8307 according to:
```
PcbDesignes/Servo/OpticalEncoder/OpticalEncoder.sch
```

| <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step6_1.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step6_2.jpg"> | <img width="300px" src="readmeResources/fullSizeServo/OptEncBuild/step7.jpg"> |
| --- | --- | --- |

3) Take the motor with the lid removed. Paint the rotor with black nail polish and glue in the optical encoder wheel on top as shown in the middle image. The dimensions of the encoder wheel can be found in:
```
CadFiles/Servo/OpticalEncoderWheelDimensions.png
```
Then carefully put the new lid on the motor without bending the steel brushes.

| <img width="500px" src="readmeResources/fullSizeServo/OptEncBuild/step8.jpg"> |
| --- |

4) Solder the four leads from the optical encoder on top of ItsyBitsy board as shown in this image.

## Micro servo modification (MG90S or SG90)
### Build instructions

| <img width="300px" src="readmeResources/microServoBuild/1_disassemble1.png"> | <img width="300px" src="readmeResources/microServoBuild/1_disassemble2.png"> | <img width="300px" src="readmeResources/microServoBuild/1_disassemble3.png"> |
| :-- | :-- | :-- |
Expand Down Expand Up @@ -186,4 +78,4 @@ Then carefully put the new lid on the motor without bending the steel brushes.
| <img width="300px" src="readmeResources/microServoBuild/5_mounting4.png"> |
| --- |

11) Put back the motor and the potentiometer into the servo. See "PcbDesignes/MicroServo/MainPcb/MainPcb.sch" for info on how to connect the microcontroller and motor driver.
11) Put back the motor and the potentiometer into the servo. See "PcbDesignes/MicroServo/MainPcb/MainPcb.sch" for info on how to connect the microcontroller and motor driver.
31 changes: 31 additions & 0 deletions Doc/PartListForRobotAndGripper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Gripper
--------

* 1 x SG90 servo

".stl" files for 3D printing:
```
CadFiles/Robot/stl/GripperBase.stl
CadFiles/Robot/stl/GripperClip.stl
CadFiles/Robot/stl/GripperFinger1.stl
CadFiles/Robot/stl/GripperFinger2.stl
CadFiles/Robot/stl/GripperMount.stl
```

Robot
--------

* 3 x Modified coreless servo
* 3 x Modified micro servo
* 1 x Gripper
* 1 x 10 x 10 mm square aluminum bar (about 500 mm)
* 1 x 15 x 15 mm square aluminum bar (about 100 mm)
* 1 x 5V Powersuply
* 1 x Fast USB to serial microcontroller (Adafruit ItsyBitsy M0 Express or Arduino MKR Zero)
* https://learn.adafruit.com/introducing-itsy-bitsy-m0
* https://store.arduino.cc/arduino-mkr-zero-i2s-bus-sd-for-sound-music-digital-audio-data

Cad and stl files for 3D printing:
```
CadFiles/Robot
```
Binary file added Doc/readmeResources/VideoTutorialImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Python/ServoProjectModules/ArduinoManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def getListOfLatestGitHubReleasAssets(url):
if url[-1] != '/':
url = url + '/'

print('Looking up latest version of "arduino-cli"...')
r = requests.get(url=f'{url}releases/latest', headers={'Accept': 'application/json'}, allow_redirects=True)

versionInfo = r.json()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def resetGuiAfterCalibration():
def updateRecordingProgressBar(fraction, pos):
stepsStr = []
stepsStr.append('1) Move the servo-output-shaft over its range of motion.\n')
stepsStr.append('2) Leave it someware in the middle.\n')
stepsStr.append('2) Leave it somewhere in the middle.\n')
stepsStr.append('3) Apply constant torque in CW direction (60 sec).\n')
stepsStr.append('4) Change torque direction to CCW (60 sec).\n')
if fraction < 0:
Expand Down
Loading

0 comments on commit cc4bba9

Please sign in to comment.