no, it doesn’t work, i have tried a various number of speed. At throttle 30000, its only spinning at 1300 rpm and anything after 30000, speed reduces. However, if running the thruster at throttle 3000 / 4000, it seems to be giving a lot more speed … I did not try any throttle above 4000 because water is splashing everywhere haha… have to clear up the mess first
I tried on another thruster as well but it is behaving in the same way. I have attached the code as below in case there is something wrong with it.
import smbus
from time import sleep
import math
bus = smbus.SMBus(1)
you may have to use “SMBus(0)” for older pi’s
DEVICE_ADDRESS = 0x29
I2c address of the motor “0x29” is the default
THROTTLE = 0x00
I2c register of the throttle (it is 16 bit/2 byte so treat it like a “word”)
#print(“starting…”)
bus.write_word_data(DEVICE_ADDRESS, THROTTLE, 0)
bus.write_word_data(DEVICE_ADDRESS, THROTTLE, 30500)
while True:
bus.write_word_data(DEVICE_ADDRESS, THROTTLE, 30500)
RPM_h = bus.read_byte_data(DEVICE_ADDRESS,0x02) #RPM i2c register
RPM_l = bus.read_byte_data(DEVICE_ADDRESS,0x03) #RPM i2c register
VOLT_h = bus.read_byte_data(DEVICE_ADDRESS,0x04) #volt i2c register
VOLT_l = bus.read_byte_data(DEVICE_ADDRESS,0x05) #volt i2c register
TEMP_h = bus.read_byte_data(DEVICE_ADDRESS,0x06) #temperature i2c register
TEMP_l = bus.read_byte_data(DEVICE_ADDRESS,0x07) #temperature i2c register
CURR_h = bus.read_byte_data(DEVICE_ADDRESS,0x08) #current i2c register
CURR_l = bus.read_byte_data(DEVICE_ADDRESS,0x09) #current i2c register
RPM = (RPM_h<<8) | RPM_l
VOLT = (VOLT_h<<8) | VOLT_l
TEMP = (TEMP_h<<8) | TEMP_l
CURR = (CURR_h<<8) | CURR_l
#Formula extracted from bluerobotics blueesc documentation
#RPM Calculation
#RPM is send as pulses since last read, which is the number
#of commutation cycles since the i2c was polled
#N(poles) for T100 is 12 and T200 is 14
#RPS(esc) = RPS(raw)/ ((N(poles) * (change of time))
#RPM(esc) = RPS(esc) * 60
#Change of time calculated is 1.~ seconds which will not significantly
#affect the calculation therefore change of time is omitted
Real_RPM = RPM / (12) * 60
print(“RPM Value is:%0.2f” %Real_RPM)
#Voltage Calculation
Real_VOLT = VOLT * 0.0004921
print(“Voltage Value is:%0.2f” %Real_VOLT)
#Temperature Calculation
#Temperature measured by a 10k themistor(NCP18XH103J03RB) and a 3.3k resistor
#calculated using steinhart-hart equation
#1/T = 1/T0 + 1/B * ln(l/T)
thermistornominal = 10000 #thermistor resistance at 25 deg C
temperaturenominal = 25 #temp for nominal resistance
bcoefficient = 3900 #beta coefficient of the thermistor
seriesresistor = 3300 #resistance of other resistor
resistance = seriesresistor / ((65535/TEMP)-1)
steinhart = resistance / thermistornominal #(R/R0)
steinhart = (math.log(steinhart) / bcoefficient
- 1/(temperaturenominal + 273.15)) #ln(R/R0) * 1/B + 1/T0
steinhart = 1/steinhart - 273.15
print(“Temperature Value is:%0.2f” %steinhart)
#Current Calculation
Real_CURR = (CURR-32767)*0.001122
print(“Current Value is:%0.2f” %Real_CURR)
#Power Calculation
Power = Real_CURR * Real_VOLT
print(“Power Value is:%0.2f” %Power)
sleep(1)