Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Fri Jan 15, 2021 9:46 pm

Hello Ghp,

Thanks for the help.

Since the programming worked before I tried to find a way to manualy select what servo should move I'm pretty sure that I did something wrong in my addition. If only I knew where I went wrong.

Greetings Josse

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Sat Jan 16, 2021 1:03 pm

Hello guys,

I continued trying to solve the mistery of not being able to select a servo rather then having a fixed servo programmed in. I realised I might be calling different variables causing the program to read nothing as servo number. That can well explain why there is no responds from a servo. When I try to fix this i get the following result:
Enter angle between 0 & 180: 30
Enter servo number between 0 &15 0
Goodbye!
Traceback (most recent call last):
File "WellEnhancer.py", line 71, in <module>
servo(sernr).angle
TypeError: 'module' object is not callable
Then I tried to call the servo numbers not servo0 through servo15 but rather 0 through 15 since that would be the input from the input number. That created the following:
File "Test160121.py", line 28
0 = servo.Servo(pca.channels[0])
^
SyntaxError: can't assign to literal
Can anyone point me to what I'm doing wrong here? Or should I make a script for every single servo output (in which I would only add those that will actually be used) and then have it respond to a certain command (for example: servo0 responding to AA, for the AA is in the final version followed by 3 numbers)? In that case I've been going at it completely the wrong way...

So the code for the not callable error below:

Code: Select all

#This program will control the shipmodel Well Enhancer build by Josse Brouwer. Software writen by Josse Brouwer
import time
from board import SCL, SDA
import busio
from adafruit_pca9685 import PCA9685
from adafruit_motor import servo

i2c = busio.I2C(SCL, SDA)

# Create a PCA9685 class instance
pca = PCA9685(i2c)
pca.frequency = 50

# To get the full range of the servo you will likely need to adjust the min_pulse and max_pulse to
# match the stall points of the servo.
# This is an example for the Sub-micro servo: https://www.adafruit.com/product/2201
# servo0 = servo.Servo(pca.channels[0], min_pulse=580, max_pulse=2480)
# This is an example for the Micro Servo - High Powered, High Torque Metal Gear:
#   https://www.adafruit.com/product/2307
# servo7 = servo.Servo(pca.channels[7], min_pulse=600, max_pulse=2400)
# This is an example for the Standard servo - TowerPro SG-5010 - 5010:
#   https://www.adafruit.com/product/155
# servo7 = servo.Servo(pca.channels[7], min_pulse=600, max_pulse=2500)
# This is an example for the Analog Feedback Servo: https://www.adafruit.com/product/1404
# servo0 = servo.Servo(pca.channels[0], min_pulse=600, max_pulse=2600)

# The pulse range is 1000 - 2000 by default.
servo0 = servo.Servo(pca.channels[0])
servo1 = servo.Servo(pca.channels[1])
servo2 = servo.Servo(pca.channels[2])
servo3 = servo.Servo(pca.channels[3])
servo4 = servo.Servo(pca.channels[4])
servo5 = servo.Servo(pca.channels[5])
servo6 = servo.Servo(pca.channels[6])
servo7 = servo.Servo(pca.channels[7])
servo8 = servo.Servo(pca.channels[8])
servo9 = servo.Servo(pca.channels[9])
servo10 = servo.Servo(pca.channels[10])
servo11 = servo.Servo(pca.channels[11])
servo12 = servo.Servo(pca.channels[12])
servo13 = servo.Servo(pca.channels[13])
servo14 = servo.Servo(pca.channels[14])
servo15 = servo.Servo(pca.channels[15])

# Start PWM running, with value of 0 (pulse off)
#servo0.start(0)
#servo1.start(0)
#servo2.start(0)
#servo3.start(0)
#servo4.start(0)
#servo5.start(0)
#servo6.start(0)
#servo7.start(0)
#servo8.start(0)
#servo9.start(0)
#servo10.start(0)
#servo11.start(0)
#servo12.start(0)
#servo13.start(0)
#servo14.start(0)
#servo15.start(0)

# loop to allow user to set servo angle. try/finally allows exit
# with execution of servo.stop

try:
	while True:
		#ask user for angle and turn servo to it
		angle = float(input('Enter angle between 0 & 180: '))
		sernr = int(input('Enter servo number between 0 &15 '))
		servo(sernr).angle
		time.sleep(0.5)
		#servo(sernr).ChangeDutyCycle(0)

finally:
	#Clean things up at the end
	#servo0.stop()
	#servo1.stop()
	#servo2.stop()
	#servo3.stop()
	#servo4.stop()
	#servo5.stop()
	#servo6.stop()
	#servo7.stop()
	#servo8.stop()
	#servo9.stop()
	#servo10.stop()
	#servo11.stop()
	#servo12.stop()
	#servo13.stop()
	#servo14.stop()
	#servo15.stop()
	print("Goodbye!")
It does feel like I'm zeroing in on the problem but cvan't seem to find the solution myself yet :roll:

I also modified my wiring diagram for use with both an Adafruit I2C controlled stepper motor controller and the suggested Sparkfun version. I decided to opt for both since the Adafruit version costs less then double the price of the Sparkfun version but is able to control 2 steppers rather that the 1 for the Sparkfun. Since I will use a total of 5 steppers this is the most cost effective way to achieve my goal. I also decided that, since under somewhat high operation levels (all propulsion full power and playing around a little bit with cranes) might easily mean a powerconsumption of some 10A, I'd best add an extra 12V 12A battery next to the 1 I already have. Then it also seemed to be the easiest to use the second battery for powering different systems then the first though I might change that to a battery switching circuit or even connecting the batteries in parallel to each other if that makes more sense. See below the diagram:
Bedrading Well Enhancer Achterschip_bb_V.jpg
Bedrading Well Enhancer Achterschip_bb_V.jpg (137.7 KiB) Viewed 783 times
See below a photo of the progress on the boat itself, I have prepared the wiring and fitted the first PWM module. Currently I still have the stepper motor controllers that came with the steppers. Here the left engine mounting was still to be adjusted to fit in the hull, that has now been done. The purple device on the left behind the frame is 1 of the 2 stern ESC's that will drive the engines and will be connected to the PWM module, and could possibly be used to power the PWM module as well since it comes equipped with a 1,2A BEC circuit.
DSC_8465_V.jpg
DSC_8465_V.jpg (166.27 KiB) Viewed 783 times
Thanks in advance.

Greetings Josse

ghp
Posts: 1918
Joined: Wed Jun 12, 2013 12:41 pm
Location: Stuttgart Germany
Contact: Website

Re: Programming for a ship model

Sat Jan 16, 2021 7:33 pm

Code: Select all

## @untested
## If you want to address servo by number, then either put them in a dict or an array.
##
servo0 = servo.Servo(pca.channels[0])
servo1 = servo.Servo(pca.channels[1])
servo2 = servo.Servo(pca.channels[2])
...

servos = []  # empty list
servos.append( servo0)
servos.append( servo1)
servos.append( servo2)
...

servo_number = int( input("servo please"))
servos[ servo_number ].angle = 42 # or whatever

# or loop for all
for servo in servos:
    servo.angle = 90 

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Sun Jan 17, 2021 11:30 am

Hello GHP,

Thanks for the help, I'll go and try to make an array. I already asked my father to help me out here as well.

So I've also took some time to plan ahead a little to give myself some direction. First of all I want to make the servo's be controlled by naming a servo and an angle or perhaps transfer to a value between 0 and 255 because this is how the ESC's need to be controlled and that way I can avoid needing to remap for either every single servo or for every ESC.
Then I'll have my first stepper motor controller so I will start testing with that and then try to combine the programmings for the stepper motor and the servo's.
Then I will try to use the commands I have intended and translate those to control the correct servo/ ESC/ stepper motor.
Lastly I will continue the work on the transmitter to get that working as well. Hopefully this will all be done for the propulsion before autumn this year, so I might get on trips like the 1 in the movie below some 10 years ago back then with my first and only attempt with Arduino controlled from my laptop with the first attempt at this project. I started building all over again 7 years ago.
https://www.youtube.com/watch?v=B-9jHcH ... e=youtu.be

Greetings Josse

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Sun Jan 17, 2021 2:26 pm

Hi GHP,

I tested your code and it works fine. Then I started adding all the remaining servo's and making it a program running all the time combining your code with what I already had and that works fine now! I had a few bumps to overcome but this time the errors made enough sense to me to solve them.
This is the combined code:

Code: Select all

## @untested
## If you want to address servo by number, then either put them in a dict or an array.
##
import time
from board import SCL, SDA
import busio
from adafruit_pca9685 import PCA9685
from adafruit_motor import servo

i2c = busio.I2C(SCL, SDA)

# Create a PCA9685 class instance
pca = PCA9685(i2c)
pca.frequency = 50

servo0 = servo.Servo(pca.channels[0])
servo1 = servo.Servo(pca.channels[1])
servo2 = servo.Servo(pca.channels[2])
servo3 = servo.Servo(pca.channels[3])
servo4 = servo.Servo(pca.channels[4])
servo5 = servo.Servo(pca.channels[5])
servo6 = servo.Servo(pca.channels[6])
servo7 = servo.Servo(pca.channels[7])
servo8 = servo.Servo(pca.channels[8])
servo9 = servo.Servo(pca.channels[9])
servo10 = servo.Servo(pca.channels[10])
servo11 = servo.Servo(pca.channels[11])
servo12 = servo.Servo(pca.channels[12])
servo13 = servo.Servo(pca.channels[13])
servo14 = servo.Servo(pca.channels[14])
servo15 = servo.Servo(pca.channels[15])

servos = []  # empty list
servos.append( servo0)
servos.append( servo1)
servos.append( servo2)
servos.append( servo3)
servos.append( servo4)
servos.append( servo5)
servos.append( servo6)
servos.append( servo7)
servos.append( servo8)
servos.append( servo9)
servos.append( servo10)
servos.append( servo11)
servos.append( servo12)
servos.append( servo13)
servos.append( servo14)
servos.append( servo15)

try:
  while True:
		#ask user for angle and turn servo to it
    angle = float(input('Enter angle between 0 & 180: '))
    servo_number = int( input("servo please"))
    servos[ servo_number ].angle = angle

finally:
	print("Goodbye!")
Thanks a lot for the help!

Next step will be translating this to using the commands I want to generate in the transmitter. I started trying this but calling servo's requires an integer so using letters requires a step of translation. My father told me to make a dictionairy for this and has also helped to get the dictionary up and running.

Code: Select all

## If you want to address servo by number, then either put them in a dict or an array.
##
import time
from board import SCL, SDA
import busio
from adafruit_pca9685 import PCA9685
from adafruit_motor import servo
from adafruit_motor import motor

i2c = busio.I2C(SCL, SDA)

# Create a PCA9685 class instance
pca = PCA9685(i2c)
pca.frequency = 50

servo0 = servo.Servo(pca.channels[0])
servo1 = servo.Servo(pca.channels[1])
servo2 = servo.Servo(pca.channels[2])
servo3 = servo.Servo(pca.channels[3])
servo4 = servo.Servo(pca.channels[4])
servo5 = servo.Servo(pca.channels[5])
servo6 = servo.Servo(pca.channels[6])
servo7 = servo.Servo(pca.channels[7])
servo8 = servo.Servo(pca.channels[8])
servo9 = servo.Servo(pca.channels[9])
servo10 = servo.Servo(pca.channels[10])
servo11 = servo.Servo(pca.channels[11])
servo12 = servo.Servo(pca.channels[12])
servo13 = servo.Servo(pca.channels[13])
servo14 = servo.Servo(pca.channels[14])
servo15 = servo.Servo(pca.channels[15])

servos = {}  # empty dictionary
servos['aa'] = servo0
servos['ab'] = servo1
servos['ac'] = servo2
servos['ad'] = servo3
servos['ae'] = servo4
servos['af'] = servo5
servos['ag'] = servo6
servos['ah'] = servo7
servos['ai'] = servo8
servos['aj'] = servo9
servos['ak'] = servo10
servos['al'] = servo11
servos['am'] = servo12
servos['an'] = servo13
servos['ao'] = servo14
servos['ap'] = servo15

try:
  while True:
    commando = 'aa120'
    srv = commando[:2]
    angle = int(commando[2:])
    servos[ srv ].angle = angle
    
finally:
	print("Goodbye!")
We stopped for today an inch short of manually giving the commands which the transmitter will later send to the boat by joystick input.

In the background I've started working on a wiring diagram for the transmitter but I'm having trouble finding out how I should wire 4 different SPI devices to 1 Pi. Do you guys have any suggestions?

Thanks in advance.

Greetings Josse

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Programming for a ship model

Sun Jan 17, 2021 9:58 pm

Tweety777 wrote:
Sun Jan 17, 2021 2:26 pm

In the background I've started working on a wiring diagram for the transmitter but I'm having trouble finding out how I should wire 4 different SPI devices to 1 Pi. Do you guys have any suggestions?

Thanks in advance.

Greetings Josse
Easy enough, each SPI device needs the MISO, MOSI and SCLK lines (connected from Pi GPIO 9-11 to every SPI device in parallel). Each SPI device also needs a chip select line, any GPIO can be used for those.

Your SPI program selects a device and makes it listen to the commands by activating the chip select and sends the commands from MOSI (Master Out Slave In) (with the Clock line making the timing of the signals clear) replies are sent back via MISO (Master In Slave Out). Only activate one SPI device at a time.
Doug.
Building Management Systems Engineer.

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Mon Jan 18, 2021 5:45 am

Hi Doug,

Thanks for the help.

For some reason i thought that SPI was rather different and more complex then I2C but I’ve done my research into how SPI actually works and now realised that it indeed works pretty similar to I2C. This makes my live a lot easier.

Greetings Josse

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Programming for a ship model

Mon Jan 18, 2021 7:27 am

They are quite different.

SPI has 3 common datalines + one unique select line per device.

I2C has 2 data lines.

SPI has a seperate line for outgoing communications than incoming communications.

I2C has individual device addressing.

With I2C any communications (which will all be along the common data line) will contain the details of the originating device (slave talking to master) or the target device (master talking to slave).

Think of I2C as a pair of tin cans connected together by a tensioned string. You can talk or you can listen but you can't do both at once.

Now add a whole bunch of extra tin cans, all the tensioned strings connecting back. Anyone could talk and everyone can hear everything.
That would be really confusing so we need a set of rules.
We let one person be in charge, they initiate all the conversations and everyone replies to them.


Think of SPI as being similar to a telephone network. You dial a number and get connected to another person. Both can talk simultaneously and still hear the other without problems.
The number dialling is the chip select, so only the master can do it. The selection just tells the slave that it has permission to listen and reply.
The data lines are unidirectional, all of the slave devices can only receive on the masters transmission line and only transmit on the masters receive line.
Doug.
Building Management Systems Engineer.

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Mon Jan 18, 2021 9:11 am

Hi Doug,

Thanks for the clear explanation. For some reason I thought that SPI would be so slow that this could hamper the control with the joysticks. Now that I'm beginning to understand more about SPI I start to realise that SPI can also communicate in microseconds so that movement of say 2 joysticks connected to 2 seperate MCP3008 will both get through to the Pi and thus result in response from whatever I want to respond.

Now I can go on and finish the wiring diagram for the transmitter.

Greetings Josse

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Sun Jan 24, 2021 6:44 pm

Hi guys,

So I've finished the wiring diagram for the transmitter apart from the pushbuttons which I will use to select the 2,4GHZ channel, see below.
Zender Well Enhancer_bb_V.jpg
Zender Well Enhancer_bb_V.jpg (243 KiB) Viewed 592 times
My father has modified my code so it should be able to give the kind of commands that will be generated by my transmitter when I'm far enough with that. When I wanted to test this code, I also switched for Moba Xterm foor SSH communications to Visual Studio. In this switch the extisting board.py and busio.py files did not come through properly and those files appear to have been deleted from the Pipy website. Has anyone else run into this problem? It means that I'll either need another library doing pretty much the same or I need to wait for Adafruit to fix this problem... The most recent code therefore still has to be tested as of yet.

Greetings Josse

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Sat Jan 30, 2021 9:39 pm

Hello guys,

For some reason I managed to get the board.py library up and running again.

In the meantime I got my first Adafruit motor HAT and decided I wanted to test it now that the servo program was working again. Unfortunately there really seems to be something wrong with the Adafdruit libraries lately because the Motorkit library also returned a 404 error. This is the code I want to use for testing puproses:

Code: Select all

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""Simple test for using adafruit_motorkit with a stepper motor"""
import time
import board
from adafruit_motorkit import MotorKit

kit = MotorKit(i2c=board.I2C())

for i in range(100):
    kit.stepper1.onestep()
    time.sleep(0.01)
Can you guys help me out to a solution?

Thanks in advance.

Greetings Josse

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Tue Apr 13, 2021 6:18 pm

Hello guys,

It's been quite a while now since my last update. I've been making myself a nice room for my hobby and also as homeoffice. Since then I also made quite some steps in making the propulsion work from the mechanical point of view. I still have some wiring to do but other then that the propulsion is good to go. This motivates me to get to programming again.

Speaking of programming, I stopped with quite some issues with the libraries needed for controlling the servo's and stepper motors. I now found out that Adafruit started using the CircuitPython programming languange for teh libraries so I now installed the required software and libraries. Still the Motor library (now called motorkit it would appear) doesn't want to work for some strange reason. I checked the file on Github and learned a thing or 2 there but nothing that gets me past a ImportError. Have you guys got any clue about this? See my code below. BTW, that is in essence the Adafruit example code which I tried to fix.

Code: Select all

# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT

"""Simple test for using adafruit_motorkit with a stepper motor"""
import time
import board
from adafruit_motorkit import MotorKit

kit = MotorKit()

for i in range(100):
    kit.stepper1.onestep()
#stepper = stepper(i2c=board.I2C())

#for i in range(100):
 #   stepper.stepper1.onestep()
  #  time.sleep(0.01)
Have you guys got any clue what could be wrong here? I do have a file called adafruit_motorkit in the lib folder and also a folder called adafruit_motor which contains the files motor.mpy, servo.mpy and stepper.mpy. I do not have a folder python3.7 in my lib folder which the error suggests to be searching for:
ImportError: cannot import name 'stepper' from 'adafruit_motor' (/home/pi/.local/lib/python3.7/site-packages/adafruit_motor/__init__.py)

Thanks in advance.

Greetings Josse
Attachments
DSC_8583_B.jpg
Since the previous power distribution for some reason didn't do anything at all I started all over again
DSC_8583_B.jpg (136.63 KiB) Viewed 358 times
DSC_8584_B.jpg
Engine's are now properly connected to the driveshafts and the stepper motors have got their gears fitted and have been placed as well. The batterypack is for testing purposes only, it will be replaced by proper juice from the 12V 12A battery
DSC_8584_B.jpg (234.23 KiB) Viewed 358 times

tannewt
Posts: 57
Joined: Tue Nov 17, 2020 1:14 am

Re: Programming for a ship model

Wed Apr 14, 2021 6:11 pm

I think you need to use pip to install the libraries. mpy files are for CircuitPython on microcontrollers, not on Raspberry Pi.

What error are you getting when running the sample code?

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Wed Apr 14, 2021 6:34 pm

Hello Tannewt,

Thanks for the help.

I used pip3 install to install the libraries, when I do, I get either of 2 responses: the first is that the library is already installed, the second is that the library cannot be found.
I also installed Blinka, that should make the translation between CircuitPython and what the Pi can understand.

See below the error:
ImportError: cannot import name 'stepper' from 'adafruit_motor'

Greetings Josse

tannewt
Posts: 57
Joined: Tue Nov 17, 2020 1:14 am

Re: Programming for a ship model

Fri Apr 16, 2021 5:20 pm

Please post the full pip output. Sounds like it didn't completely install everything.

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Fri Apr 16, 2021 6:54 pm

Hello Tannewt,

These are the Pip3 results, both from :
pip3 install adafruit_motor
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting adafruit_motor
Could not install packages due to an EnvironmentError: 404 Client Error: Not Found for url: https://pypi.org/simple/adafruit-motor/

Code: Select all

pip3 install adafruit_circuitpython_motorkit
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting adafruit_circuitpython_motorkit
  Downloading https://www.piwheels.org/simple/adafruit-circuitpython-motorkit/adafruit_circuitpython_motorkit-1.6.2-py3-none-any.whl
Requirement already satisfied: adafruit-circuitpython-pca9685 in ./.local/lib/python3.7/site-packages (from adafruit_circuitpython_motorkit) (3.3.2)
Requirement already satisfied: adafruit-circuitpython-busdevice in ./.local/lib/python3.7/site-packages (from adafruit_circuitpython_motorkit) (5.0.1)
Requirement already satisfied: adafruit-circuitpython-register in ./.local/lib/python3.7/site-packages (from adafruit_circuitpython_motorkit) (1.9.1)
Requirement already satisfied: Adafruit-Blinka in ./.local/lib/python3.7/site-packages (from adafruit_circuitpython_motorkit) (6.4.2)
Requirement already satisfied: adafruit-circuitpython-motor in /usr/local/lib/python3.7/dist-packages (from adafruit_circuitpython_motorkit) (3.2.3)
Requirement already satisfied: RPi.GPIO in /usr/lib/python3/dist-packages (from Adafruit-Blinka->adafruit_circuitpython_motorkit) (0.7.0)
Requirement already satisfied: Adafruit-PureIO>=1.1.7 in ./.local/lib/python3.7/site-packages (from Adafruit-Blinka->adafruit_circuitpython_motorkit) (1.1.8)
Requirement already satisfied: pyftdi>=0.40.0 in ./.local/lib/python3.7/site-packages (from Adafruit-Blinka->adafruit_circuitpython_motorkit) (0.52.0)
Requirement already satisfied: sysv-ipc>=1.1.0 in ./.local/lib/python3.7/site-packages (from Adafruit-Blinka->adafruit_circuitpython_motorkit) (1.1.0)
Requirement already satisfied: rpi-ws281x>=4.0.0 in ./.local/lib/python3.7/site-packages (from Adafruit-Blinka->adafruit_circuitpython_motorkit) (4.2.5)
Requirement already satisfied: Adafruit-PlatformDetect>=3.1.0 in ./.local/lib/python3.7/site-packages (from Adafruit-Blinka->adafruit_circuitpython_motorkit) (3.5.0)
Requirement already satisfied: pyserial>=3.0 in /usr/lib/python3/dist-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit_circuitpython_motorkit) (3.4)
Requirement already satisfied: pyusb>=1.0.0 in ./.local/lib/python3.7/site-packages (from pyftdi>=0.40.0->Adafruit-Blinka->adafruit_circuitpython_motorkit) (1.1.0)
Installing collected packages: adafruit-circuitpython-motorkit
Successfully installed adafruit-circuitpython-motorkit-1.6.2
See screenshot below for the error I get from the Motorkit library.
Adafruit_motorkit error.JPG
Adafruit_motorkit error.JPG (41.92 KiB) Viewed 261 times
So, somehow I only get errors, but somehow, even though the file is in the correct folder, I only get errors. Can anyone figure out what is wrong here?

Thanks in advance.

Greetings Josse

tannewt
Posts: 57
Joined: Tue Nov 17, 2020 1:14 am

Re: Programming for a ship model

Mon Apr 19, 2021 8:09 pm

I'd suggest asking on https://forums.adafruit.com/viewforum.php?f=60 I don't do much work Blinka myself.

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Tue Apr 20, 2021 3:32 pm

Hello Tannewt,

Thanks for the advice.

I started a topic about this subject last weekend, thinking it might well be a typo in the actual library. I haven't yet had any useful answer at this point.

Greetings Josse

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Sat May 01, 2021 8:43 am

Hello guys,

Unfortunately I don't get any response from Adafruit, so I started wandering if I could use a different library to get the same result? Or could I implement the code from the library in my own programming?

Last week I've been working on getting the power running in the ship and I've succeeded in that. I still need to attach 1 of the PWM modules but apart from that all the running electronics are connected and the ESC's are connected to the PWM modules.

Thanks for the help guys.

Greetings Josse

BMS Doug
Posts: 4423
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Programming for a ship model

Sun May 02, 2021 11:14 am

Your adafruit MotorKit should be importing this file stepper.py (or an older version of it) if you have a stepper.mpy then you are looking at micro-python file, which might indicate that you have the wrong set of downloads?

I'd look at reinstalling the libraries. If the pip installer isn't working correctly you can find them on github here
Doug.
Building Management Systems Engineer.

Tweety777
Posts: 30
Joined: Tue Jun 30, 2015 11:26 am
Location: The Netherlands

Re: Programming for a ship model

Sat May 15, 2021 2:28 pm

Hello Doug,

Just for the sake it I completely re-installed the entire OS and have been trying to re-install the libraries. Still not much result.

The .mpy files are from the Circuitpython programming laungauge, that has taken over where Micropython has started. Apparently this is the road Adafruit has chosen to go for there libraries. Circuitpython and Blinka should make sure that Python understands the libraries with the .mpy files. Some more digging into this problem learned me that Circuitpython seems to work with some project folder so I started to incorporate that and I can see the library in the project folder but for some reason the program still can't find it. I really hope to find some solution fast, I'm starting to get impatienced with this library issue. Not finding a way to make the program do what I want it to do because I don't know how to command it to do so is 1 thing, not getting something to work made by others is much more frustrating to me.

Anyways, whenever I do got this issue fixed I will be able to test the propulsion of the ship straight away since I've got the wiring sorted out.

Greetings Josse

Return to “Automation, sensing and robotics”