Open Gunzo182 opened 4 years ago
Hi Richard,
the data snippet '1' 03 0c 00 00 07 10 00 00 65 6F 7F 18 0D 09 '0' '0' '0' '0' 91 0F '23' is from you logic analyzer and not from the ttyT1941.py? With '0C' instead of '0c' in the third number, this decodes to a valid version answer from your brake:
Powerback
firmwareVersion= 00.00.10.07
serial= 411004773 (Tacx T1941 Year 2010 #04773)
Date= 09.0d Unknown= 00.00
The serial '411004773' should match your serial on the powerback unit.
Looks more like a cable problem on the data line from your brake to the CP2102 adapter. Can you check the cable from your trainer to the cp2102? Did you made the "loopback test"? Mabye you can short the RX/TX lines at the point where you connect your analyzer?
EDIT: For better analyzing the data, can you please uncomment the following lines in the ttyT1941.py source code?
print(answerRaw)
print("R:"+' '.join(format(x, '02x') for x in answerRaw))
print("D:"+' '.join(format(x, '02x') for x in answerDecoded))
On my ride today I had another thought: Maybe the CP2102 does not have a pull-up resistor on the RX line. I had a similar problem some time ago with another device. I do not know your CP2102 device, but maybe you try to add a 10kOhm resistor between your RX line and Vcc (the 3.3V voltage line).
Wow, thanks for the replies. Jump straight to **
So yes, the reply is from the logic analyzer and it is '0C' and not '0c'. My Serial number is: 41104773.
I uncomment the 3 lines you indicated. With the loopback test I get:
Using /dev/ttyUSB0
b'\x010200000043A8\x17'
R:01 30 32 30 30 30 30 30 30 34 33 41 38 17
D:02 00 00 00
bytearray(b'\x02\x00\x00\x00')
b'\x010200000043A8\x17'
R:01 30 32 30 30 30 30 30 30 34 33 41 38 17
D:02 00 00 00
I removed the powerback RX/TX lines for this test. Am I right to do this?
**Never-mind...Wow thanks for going for a ride, I assume you mean on the bike? I added the resistor and lo and behold:
$ python3 ttyT1941_01.py -c
Using /dev/ttyUSB0
b'\x01030C000007100000656F7F180D0900008A14\x17'
R:01 30 33 30 43 30 30 30 30 30 37 31 30 30 30 30 30 36 35 36 46 37 46 31 38 30 44 30 39 30 30 30 30 38 41 31 34 17
D:03 0c 00 00 07 10 00 00 65 6f 7f 18 0d 09 00 00
Powerback
firmwareVersion= 00.00.10.07
serial= 411004773 (Tacx T1941 Year 2010 #04773)
Date= 09.0d Unknown= 00.00
Watch out: Brake accelerates the wheel to 20 km/h.
The calibration process runs for about 50 seconds to warm up the
wheel and the brake. Rerun calibration if values are not stable at the end.
If - for some reason - the program crashes while calibrating, the brake
continues wheeling. Start the programm again in non-calibrating mode to stop.
Brake is 'armed' for calibration - now turn the wheel with at least 5 km/h to
start the calibration (then stop pedalling).
b'\x0103130200000000000000F0600000000000000000000003FEF2\x17'
R:01 30 33 31 33 30 32 30 30 30 30 30 30 30 30 30 30 30 30 30 30 46 30 36 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 33 46 45 46 32 17
D:03 13 02 00 00 00 00 00 00 00 f0 60 00 00 00 00 00 00 00 00 00 00 03
.b'\x0103130200000000000000E0600000000000000000000003F5B2\x17'
R:01 30 33 31 33 30 32 30 30 30 30 30 30 30 30 30 30 30 30 30 30 45 30 36 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 33 46 35 42 32 17
D:03 13 02 00 00 00 00 00 00 00 e0 60 00 00 00 00 00 00 00 00 00 00 03
So when I turned the wheel it did the calibration.
Running the program without any extra instructions:
python3 ttyT1941_01.py
Using /dev/ttyUSB0
b'\x01030C000007100000656F7F180D0900008A14\x17'
R:01 30 33 30 43 30 30 30 30 30 37 31 30 30 30 30 30 36 35 36 46 37 46 31 38 30 44 30 39 30 30 30 30 38 41 31 34 17
D:03 0c 00 00 07 10 00 00 65 6f 7f 18 0d 09 00 00
Powerback
firmwareVersion= 00.00.10.07
serial= 411004773 (Tacx T1941 Year 2010 #04773)
Date= 09.0d Unknown= 00.00
b'\x0103130200B61100000000586100000000000000000000023C7B\x17'
R:01 30 33 31 33 30 32 30 30 42 36 31 31 30 30 30 30 30 30 30 30 35 38 36 31 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 32 33 43 37 42 17
D:03 13 02 00 b6 11 00 00 00 00 58 61 00 00 00 00 00 00 00 00 00 00 02
DST= 4534, PWR= 0, PWRAvg= 0, Wheel= 0, SPD= 0
.0, CAD= 0, CadSensor=0, U3435=24920 ForceAvg= 0, Force= 0, LoadEcho= 0 Load= 0
and then spinning the wheel with my hands:
b'\x0103130200EE110000C108A067000082082E2C00000000025E24\x17'
R:01 30 33 31 33 30 32 30 30 45 45 31 31 30 30 30 30 43 31 30 38 41 30 36 37 30 30 30 30 38 32 30 38 32 45 32 43 30 30 30 30 30 30 30 30 30 32 35 45 32 34 17
D:03 13 02 00 ee 11 00 00 c1 08 a0 67 00 00 82 08 2e 2c 00 00 00 00 02
DST= 4590, PWR= 37, PWRAvg= 0, Wheel=2241, SPD= 7.7, CAD= 0, CadSensor=0, U3435=26528 ForceAvg= 0, Force= 2178, LoadEcho=11310 Load=11310
Thanks for the help and the insight on the pull-up resistor. I would never even have known about the pull-up issue.
According to the code snippets I shared with you, does everything seem fine? I will test your program further within the next couple of days, and then I would like to move forward to getting it integrated into FortiusAnt and then to have it run on my RPi.
(just on a side note, do you think the cad sensor works on a switch principle - every time the magnet passes the sensor it closes a switch and pulls down a voltage?) I don't have the cad sensor, but I would think it would be easy to use another "cheap' sensor.
Thanks again!
Your logs are looking good (note: the power values of the tty1941.py demonstrator are based on an old power model).
cad sensor: I haven't opened the sensor case, but it is very probably a simple reed switch. The original part number is T1947 (Tacx Cadence Sensor).
At least my fortius trainer (from year 2005) triggers some kind of "emergency stop" after a few seconds, if there is no cad signal.
Good!
When you refer to the old power model, is it a formula, fixed value or variable that needs updating? I know there is a table (Powercurve factor) that WouterJD is using in his program, would that be part of the correct model?
Thanks,
Yes, WouterJD uses an update power model.
Hi totalreverse,
I tried a couple of settings and then to pedal with a mounted bicycle. (Standard, Slope and Ergo) I did not expect perfection but the motor-brake is very jittery, and locks up very few seconds. I would just like to know:
I'm not ungrateful for what I have, I just want to dig in to getting it to work as I expect. I am slowly getting into your code to understand it better, but for now I want to eliminate any wrong assumptions.
Thanks for all the help.
At least the lock is probably caused by the missing signal from the pedal sensor.
At low speeds the trainer may feel somehow 'jittery'. Please first try to fix the 'lock' problem by adding a pedal sensor, so you can achieve high speeds. Then you can play with the slope and ergo modes. In slope mode the tty1941 is passive and the trainer applies a constant force. Due to the virtual fly-wheel setting of 0x52 the trainer feels less responsive in slope mode.
Hi, I ty to use your software to establish communication with T1601 eddy break, I want read parameters and send to BLE adapter.
Now i have problem with reading frame
bytearray(b'') frame too short b'' R: D:
after rotating the wheel i see amount of the "00" depends on the wheel speed.
could anyone help me with this task ?
Hi @totalreverse,
I'm Richard form South Africa. Thank you for all the work you've done on the T1941 motor brake's communication.
Can you help me please. I've been trying to get my trainer to work without a head. I had a T1932, but I can confirm it's dead. It's not communicating over serial.
I am not very lingual in hardware communication, so please excuse my lack of understanding. I am able to run your program. I am sending signals, and receiving signals over a CP2102. I confirmed this using a logic analyzer. But when running the calibrate command (or any other command) I get the following message:
My trainer replies with the following string: '1' 03 0c 00 00 07 10 00 00 65 6F 7F 18 0D 09 '0' '0' '0' '0' 91 0F '23' (I can send you the logic data if you require it.)
Is this an expected reply? Should I change anything in your code to adapt to my trainer?
How do I get my trainer to do anything, or to send any sensor information back? In the end I'm trying to have an interface to my T1941 Motor brake so that WouterJD's FortuisAnt can use the interface to talk to Zwift or any other virtual training software.
I hope I'm clear on what my issue is, and on what my end goal is?
Can you please guide me on how to develop this interface, if it's possible.
Thank you