Thunderborg not found.

In October I succesfully built my monsterborg and everything worked well. Now I had to reinstall Raspberry pi os and when trying to execute ./runMonsterJoy.sh I get an error message saying missing thunderborg at 15, thunderborg was not found. I checked everything and it should work fine (I tested it using i2c detect and it says that i2c addres 15 is in use). Please let me know if you need further information.

Edit: I ran a pintest using wiringpi this is the result (I think this means every pin should be working fine):

Images: 
piborg's picture

It is quite unusual that the ThunderBorg shows up in i2cdetect but still does not communicate. We will need a bit more detail on why it does not find the board to fix the problem.

The first thing to check is if you have installed anything else that is using the GPIO. This includes running other MonsterBorg scripts at startup (such as the Web UI). If two things are both trying to talk to the ThunderBorg at the same time it can prevent normal operation. You will also need to restart the Pi after running the pin test for the same reason.

If that is not the case we can try and talk to the ThunderBorg directly to see what is going wrong. Start by opening Python in the MonsterBorg directory:

cd ~/monsterborg
python

Then run these commands to manually ask the board to identify itself:

import ThunderBorg
TB = ThunderBorg.ThunderBorg()
TB.InitBusOnly(1, 0x15)
print TB.RawRead(0x99, 6)

This is the output we would expect when everything is working correctly:

pi@raspberrypi:~ $ cd monsterborg/
pi@raspberrypi:~/monsterborg $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ThunderBorg
>>> TB = ThunderBorg.ThunderBorg()
>>> TB.InitBusOnly(1, 0x15)
>>> print TB.RawRead(0x99, 6)
[153, 21, 0, 0, 0, 0]
>>>

Hello,
Thanks for your response!

I'm quite sure the only thing that runs on start is monsterjoy which doesn't work.

I also tried the code you provided and it gives the correct output (the same result shown in the example):

Images: 
piborg's picture

That's unexpected, but it does mean that the ThunderBorg is communicating correctly.

What result do you get if you do the initialisation from Python:

import ThunderBorg
TB = ThunderBorg.ThunderBorg()
TB.Init()

I would expect the last line to print:

Loading ThunderBorg on bus 1, address 15
Found ThunderBorg at 15
ThunderBorg loaded on bus 1

Hi,
Thanks for your response!

This are my results (the expected results):

Images: 

I think I know what the problem is. Before I got the error about not finding the thunderborg I got an error about that the module pygame was not found, I made it so the script (./runMonsterJoy.sh) will run in python3 because that does work since pygame seems only to be installed for python3. The problem is the thunderborg would not work then because the code doesn't work for python3. I tried to copy the pygame which is in dist-packages for python3 to the dist-packages for python2. Now I get another error, this probably means the pygame version isn't compatible with python2.

Conclusion: I think I should install a version of pygame that is compatible with python2. (I'm not sure if this is possible since a few months ago they dropped support for python2.)

Could this be the problem? If so, do you know how to fix it?

piborg's picture

That would explain things, the standard copy of ThunderBorg.py does not work with Python 3 :(

The good news is that we have a newer script for controlling MonsterBorg that does not use pygame at all. It instead uses our Gamepad library to get controller inputs: https://github.com/piborg/Gamepad

The monsterJoy.py example should function the same as the standard joystick script, except it is setup for a PS4 controller by default. The controller type and button settings can be changed in the settings section towards the top of the new script.

Installation is really simple:

cd ~
git clone https://github.com/piborg/Gamepad

The wiki page has a quick explanation of how everything works if you want to make any changes or improvements of your own :)

We also have a Python 3 version of ThunderBorg.py available if you prefer. See ThunderBorg with Python 3

Hi,
It works!

Thank you so much!

The car is working perfectly but for some reason turning left is putting the joystick to the left top and turning right is putting the joystick to the right bottom. I use the Piborg gamepad and not the python 3 version of thunderborg. Do you maybe know why this happens?

piborg's picture

Turning left should be pushing the left stick up to set speed while pushing the right stick to the left to steer. Turning left should be pushing the left stick up to set speed while pushing the right stick to the right to steer.

If that is not the case then it is fairly simple to fix, it just means that Controllers.py has the wrong values for your controller :)

First check you have the correct controller set in monsterJoy.py:

# Settings for the gamepad
gamepadType = Gamepad.PS4               # Class for the gamepad (e.g. Gamepad.PS3)

there are presets for:

  • PS3
  • PS4
  • Xbox360
  • MMP1251 (old controller we used to sell)

If you do not have a listed controller follow the instructions here under the "Setting up your own controllers" section (about half-way down the page). The names used in monsterJoy.py are:

  • LEFT-Y
  • RIGHT-X
  • L2
  • R2
  • PS
  • CROSS

but they can be changed to anything you want.

If you do have one of the listed controllers then the mapping is different from what is listed. You can follow the "Setting up your own controllers" as linked above to check if the names returned are correct for each axis and button. If they are wrong swap the values with what it thinks is being pressed and that should sort things out. If lots of values are wrong it may be quicker to redo the whole mapping from scratch.

My i2cdetect shows my Thunderborg on bus 1 at 0x15 but it will not connect. When I tried connecting directly in the python interpreter to get the raw output, I got python errors.

I had already run 2to3 on ThunderBorg.py but apparently that only fixed the easy stuff.

Are there going to be Python 3.9 compatible versions of the module?

Disregard... I found the link in another post:
wget -O ThunderBorg3.py http://forum.piborg.org/downloads/thunderborg/ThunderBorg3.py.txt

Still not connecting...
This is confusing...it seems to be saying..."There is no board at 15 but I found a board at 15"

Loading ThunderBorg on bus 1, address 15
Missing ThunderBorg at 15
ThunderBorg was not found
Are you sure your ThunderBorg is properly attached, the correct address is used, and the I2C drivers are running?
Scanning I²C bus #1
Found ThunderBorg at 15
1 ThunderBorg board found
No ThunderBorg at address 15, but we did find boards:
15 (21)
If you need to change the I²C address change the setup line so it is correct, e.g.
TB.i2cAddress = 0x15

>>> print (TB.RawRead(0x99,6))
Traceback (most recent call last):
File "", line 1, in
File "/home/pi/Rover/ThunderBorg3.py", line 236, in RawRead
self.RawWrite(command, [])
File "/home/pi/Rover/ThunderBorg3.py", line 220, in RawWrite
self.i2cWrite.write(rawOutput)
OSError: [Errno 121] Remote I/O error

piborg's picture

I just tried this on a recent Raspberry Pi install and the result came back with the expected result:

pi@raspberrypi:~/thunderborg $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ThunderBorg3 as ThunderBorg
>>> TB = ThunderBorg.ThunderBorg()
>>> TB.InitBusOnly(1, 0x15)
>>> print(TB.RawRead(0x99, 6))
[153, 21, 0, 0, 0, 0]
>>>

The standard initialisation also worked with the Python 3 version of the script:

pi@raspberrypi:~/thunderborg $ python
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ThunderBorg3 as ThunderBorg
>>> TB = ThunderBorg.ThunderBorg()
>>> TB.Init()
Loading ThunderBorg on bus 1, address 15
Found ThunderBorg at 15
ThunderBorg loaded on bus 1
>>>

I have not seen the OSError: [Errno 121] Remote I/O error before, but it sounds like it is having trouble with the I2C communications.

What result do you get from this command: sudo i2cdetect -y 1

This is what we would expect to see:

pi@raspberrypi:~/thunderborg $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:                         -- -- -- -- -- -- -- --
10: -- -- -- -- -- 15 -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~/thunderborg $

Also do you have any other devices or scripts using the I2C bus?

Had to force the i2c address to something other than 15 and then back to 15...now its working. :/

Subscribe to Comments for "Thunderborg not found."