The Leonardo pro micro’s pinout is laid differently than what Helder used on his board. What hex did you use and which pin are you using for battery monitoring?Doktor.Dulli wrote: ↑Tue Oct 10, 2017 1:44 amHello,
Thanks for your great work. Unfortunately I am not able to setup your script to work as it should. I tried debug = 1 to get a hint and to see output of you script.
I'am using it together with the Arduino Leonardo Pro Micro (like lotusalex2000). This works, the Micro is sending the right values. I keep the Analog Pin connected to 5v first of all.
As long as the Micro is not connected to the RaspberryPi, the (Serial Port ACM0 / 1 / 2 not found) loop shows up on screen.
When i connect it, I see your battery symbol on top of my screen, I see values for the voltage (ret) but, now starts the trouble, only six times and nothing else, only cursor.
Like thiswhen i try "screen /dev/ttyACM2 115200" I see the serial values from the Micro for my Voltage (1023 for 5V). When I change the voltage, i see the right values, too, eg. 0Vs shows 0 and so on. So this works.Code: Select all
Serial Port ACM0 not found Serial Port ACM1 not found Serial Port ACM2 not found 5,1 5,1 5,1 5,1 5,1 5,1 _
Only the loop stops, it wont change to Volts<25 when i try 0Vs on the Analog Input, it wont shutdown, only blinking cursor.
When I reboot the same. It will do the shutdown-script, when I reboot with 0V connected
thanking you in anticipation for helping
OSD Battery Monitoring for Helder's AIO Boards
Re: OSD Battery Monitoring for Helder's AIO Boards
-
- Posts: 2
- Joined: Tue Oct 10, 2017 1:21 am
Re: OSD Battery Monitoring for Helder's AIO Boards
I took the Analog-Boot hex and I'm using the A1-Pin of the micro.
Iwant to use my micro with a gamepad lib as a gamepad, which works well with Windows. Even the thumbstick with A2 and A3 Pin works well.
- Wailer
- Posts: 119
- Joined: Mon Jan 15, 2018 3:45 pm
- Location: Tiel, The Netherlands
- Has thanked: 30 times
- Been thanked: 38 times
Re: OSD Battery Monitoring for Helder's AIO Boards
Hey Hoolyhoo,
I know it's an old thread, but i still have a question!
Can you include the arduino sketch (ino) in your repo? The hex is great but if you have a different button layout on your leo/teensy you have to rewire your buttons after loading your hex (non AIO that is).
With the sketch you only have to add your battery monitor part to your own sketch.
Maybe the (arduino) code is posted somewhere else and i overlooked, if that is so my apologies.
I know it's an old thread, but i still have a question!
Can you include the arduino sketch (ino) in your repo? The hex is great but if you have a different button layout on your leo/teensy you have to rewire your buttons after loading your hex (non AIO that is).
With the sketch you only have to add your battery monitor part to your own sketch.
Maybe the (arduino) code is posted somewhere else and i overlooked, if that is so my apologies.
-
- Posts: 14
- Joined: Fri May 11, 2018 12:49 am
- Location: Rome, Italy
- Has thanked: 2 times
Re: OSD Battery Monitoring for Helder's AIO Boards
Hi,
I am in the same situation here.. i am really confused on how to use my teensy 2.0 as a gamepad + battery monitor.. i flashed the hex but i am unable to assign the correct pins..if anyone could help would be very appreciated..
I am in the same situation here.. i am really confused on how to use my teensy 2.0 as a gamepad + battery monitor.. i flashed the hex but i am unable to assign the correct pins..if anyone could help would be very appreciated..
- Wailer
- Posts: 119
- Joined: Mon Jan 15, 2018 3:45 pm
- Location: Tiel, The Netherlands
- Has thanked: 30 times
- Been thanked: 38 times
Re: OSD Battery Monitoring for Helder's AIO Boards
I am actually using the sketch found in this thread.JackReacher wrote: ↑Sat May 12, 2018 1:00 pmHi,
I am in the same situation here.. i am really confused on how to use my teensy 2.0 as a gamepad + battery monitor.. i flashed the hex but i am unable to assign the correct pins..if anyone could help would be very appreciated..
https://sudomod.com/forum/viewtopic.php ... sd+arduino
But I've got a feeling that it's not accurate enough...
A little "nervous" battery symbol (when battery level is getting at a switching point) and the "battery low" message is kicking in quite fast (maybe too soon).
So i wanted to compare this sketch with Hoolyhoo's original arduino sketch.
Just for info, hex files are already compiled sketch files who only need to be uploaded to your arduino.
They cannot be edited.
Sketches can but, you need the arduino ide to compile and upload.
https://www.arduino.cc/en/Main/Software
Re: OSD Battery Monitoring for Helder's AIO Boards
Hello, actually I looked and couldn’t find the source file I made but it’s very similar to the post in the link.Wailer wrote: ↑Sun May 13, 2018 8:04 amI am actually using the sketch found in this thread.JackReacher wrote: ↑Sat May 12, 2018 1:00 pmHi,
I am in the same situation here.. i am really confused on how to use my teensy 2.0 as a gamepad + battery monitor.. i flashed the hex but i am unable to assign the correct pins..if anyone could help would be very appreciated..
https://sudomod.com/forum/viewtopic.php ... sd+arduino
But I've got a feeling that it's not accurate enough...
A little "nervous" battery symbol (when battery level is getting at a switching point) and the "battery low" message is kicking in quite fast (maybe too soon).
So i wanted to compare this sketch with Hoolyhoo's original arduino sketch.
Just for info, hex files are already compiled sketch files who only need to be uploaded to your arduino.
They cannot be edited.
Sketches can but, you need the arduino ide to compile and upload.
https://www.arduino.cc/en/Main/Software
You should be able to adjust the battery level icons and video kick in by adjusting the values in the python part of the script. The Arduino sketch only passes the battery levels but the python script does the work.
-
- Posts: 14
- Joined: Fri May 11, 2018 12:49 am
- Location: Rome, Italy
- Has thanked: 2 times
Re: OSD Battery Monitoring for Helder's AIO Boards
Thanks wailer, thanks hooly, I saw the thread you are referring a few days ago, but the pins on my teensy are differently numbered, i tried to change but i kept getting error messages (that happens when you are out of you depth
)
Also in that thread says to upload the sketch and then install everything from the hooly guide which is something that got me confused: is it referring to the pyton part on the raspberry?
I guess my knowlwdge here is very limited so if you are able to help me out it would be great!


Also in that thread says to upload the sketch and then install everything from the hooly guide which is something that got me confused: is it referring to the pyton part on the raspberry?
I guess my knowlwdge here is very limited so if you are able to help me out it would be great!
- Wailer
- Posts: 119
- Joined: Mon Jan 15, 2018 3:45 pm
- Location: Tiel, The Netherlands
- Has thanked: 30 times
- Been thanked: 38 times
Re: OSD Battery Monitoring for Helder's AIO Boards
You're on the right track.
In a nutshell, the arduino measure's the battery voltage and passes this to the raspberry (when asked).
So...
You have to upload the sketch from lotusalex2000 to your arduino and the script from hoolyhoo to your raspberry.
If you open the arduino sketch you can change the button layout in the first part.
I adapted this piece to my leo, i will try to post my code as reference.
I changed a few other things as well, making it easier to remap your buttons.
But will need access to my laptop for that...
Will get back on this....
In a nutshell, the arduino measure's the battery voltage and passes this to the raspberry (when asked).
So...
You have to upload the sketch from lotusalex2000 to your arduino and the script from hoolyhoo to your raspberry.
If you open the arduino sketch you can change the button layout in the first part.
Code: Select all
#define NUM_BUTTONS 17
#define BTN_UP 0
#define BTN_DOWN 1
#define BTN_LEFT 2
#define BTN_RIGHT 3
#define BTN_A 4
#define BTN_START 5
#define BTN_Y 6
#define BTN_L1 7
#define BTN_X 8
#define BTN_R1 9
#define BTN_B 10
#define BTN_SELECT 14
I changed a few other things as well, making it easier to remap your buttons.
But will need access to my laptop for that...
Will get back on this....
-
- Posts: 14
- Joined: Fri May 11, 2018 12:49 am
- Location: Rome, Italy
- Has thanked: 2 times
Re: OSD Battery Monitoring for Helder's AIO Boards
Thanks, i will try again..
Only one question where do i change the code to assign pin 21(A0) to the battery reading? Is it handled by the second part of the script and works by its own or do i have to tinker with it?
Only one question where do i change the code to assign pin 21(A0) to the battery reading? Is it handled by the second part of the script and works by its own or do i have to tinker with it?
- Wailer
- Posts: 119
- Joined: Mon Jan 15, 2018 3:45 pm
- Location: Tiel, The Netherlands
- Has thanked: 30 times
- Been thanked: 38 times
Re: OSD Battery Monitoring for Helder's AIO Boards
That's in the Gamepad.write(); section
Just change A0 in the analog input you want to use (A0 to A3).
This line:
int sensorValue = analogRead(A0);
You can only use this analog inputs No other!
The other pins are digital only, for this reason the arduino is used, the raspberry has no means of analog reading (otherwise things would have been a lot simpler).
Don't forget the 10K resistor and wire this via the on/of switch to the +side of you lipo.
This 3v line has to be disconnected when the system is down to prevent damage to your arduino (theoretically, because my kids regularly forget to throw the switch after playing with no serious problems so far
but better be safe then sorry!).
Just change A0 in the analog input you want to use (A0 to A3).
This line:
int sensorValue = analogRead(A0);
You can only use this analog inputs No other!
The other pins are digital only, for this reason the arduino is used, the raspberry has no means of analog reading (otherwise things would have been a lot simpler).
Don't forget the 10K resistor and wire this via the on/of switch to the +side of you lipo.
This 3v line has to be disconnected when the system is down to prevent damage to your arduino (theoretically, because my kids regularly forget to throw the switch after playing with no serious problems so far

Who is online
Users browsing this forum: No registered users and 1 guest