Arduino Leonardo pro micro
Re: Arduino Leonardo pro micro
An easy way to test the set up is plug your arduino into your pc (not your zero) and go here
http://html5gamepad.com/
You'll see your device show up as such
http://html5gamepad.com/
You'll see your device show up as such
-
- Posts: 47
- Joined: Tue Nov 21, 2017 4:50 am
- Has thanked: 8 times
- Been thanked: 32 times
- tinkerBOY
- Posts: 710
- Joined: Tue May 30, 2017 4:00 am
- Has thanked: 294 times
- Been thanked: 206 times
Re: Arduino Leonardo pro micro
Very nice tool!32teeth wrote: ↑Tue Aug 15, 2017 8:18 pmAn easy way to test the set up is plug your arduino into your pc (not your zero) and go here
http://html5gamepad.com/
You'll see your device show up as such
Screen Shot 2017-08-15 at 10.17.54 PM.png
New! tinkerBOY PowerSwitch v1.0 with Safe Shutdown
Game Boy Zero Controllers available @ tinkerBOY.xyz * Support
tinkerBOY Controller v3.0 - built-in usb controller, usb audio, and usb hub
tinkerBOY Controller v2.0 - GPIO buttons and builtin PWM Audio and Amplifier
tinkerBOY Controller v1.1 - simple pcb button
* DPI Adapter - better display for GBZ
* keyboard converters - IBM XT/AT Soarer's Converter | ADB to USB Converter
Game Boy Zero Controllers available @ tinkerBOY.xyz * Support
tinkerBOY Controller v3.0 - built-in usb controller, usb audio, and usb hub
tinkerBOY Controller v2.0 - GPIO buttons and builtin PWM Audio and Amplifier
tinkerBOY Controller v1.1 - simple pcb button
* DPI Adapter - better display for GBZ
* keyboard converters - IBM XT/AT Soarer's Converter | ADB to USB Converter
- correia5022
- Posts: 202
- Joined: Mon Dec 05, 2016 12:32 am
- Location: Portugal
- Has thanked: 17 times
- Been thanked: 38 times
Re: Arduino Leonardo pro micro
Well i tryed this method and it doesnt work, or maybe i got the wrong monitor script.
i have readings (using a voltmeter) of 3.49v and 3.22v to A0 pin, and in the screen the battery indicator stayed the same, full.
But at 2,7v it drop all the way to red, and the sutdown beggins...
Where did i messed up? sript or your code?
(probably the author wont be here, but would apreciate other people's help)
i have readings (using a voltmeter) of 3.49v and 3.22v to A0 pin, and in the screen the battery indicator stayed the same, full.
But at 2,7v it drop all the way to red, and the sutdown beggins...
Where did i messed up? sript or your code?
(probably the author wont be here, but would apreciate other people's help)
________________________________________
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
- correia5022
- Posts: 202
- Joined: Mon Dec 05, 2016 12:32 am
- Location: Portugal
- Has thanked: 17 times
- Been thanked: 38 times
Re: Arduino Leonardo pro micro
Let me go through the setup:
I connected the vcc pin of the arduino to a series of resistors, so i could use the common ground (i was intented to use an external power supply, but realized i must need the ground from the "battery", so simulated it through the vcc)
So, first i used the code, as is, but not worked, i made jumper wires in a breadboard and some resistors to get some typical voltage values to A0 pin of the arduino. The led is always blinking by the way..
So changed the code, to 4.18 in the voltage parameter calculation, and 3.3 in the led blink function.
Still, not working. same on the screen
I had previously installed the HoolyHoo's battery monitor script using ssh via putty
If anyone can help me with this, would be apreciated
I connected the vcc pin of the arduino to a series of resistors, so i could use the common ground (i was intented to use an external power supply, but realized i must need the ground from the "battery", so simulated it through the vcc)
So, first i used the code, as is, but not worked, i made jumper wires in a breadboard and some resistors to get some typical voltage values to A0 pin of the arduino. The led is always blinking by the way..
So changed the code, to 4.18 in the voltage parameter calculation, and 3.3 in the led blink function.
Still, not working. same on the screen
@3,49VShow
@3,22VShow
SpoilerShow
wget https://raw.githubusercontent.com/Hooly ... Install.sh
sudo chmod 755 Install.sh
./Install.sh
sudo reboot
sudo chmod 755 Install.sh
./Install.sh
sudo reboot
________________________________________
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
- correia5022
- Posts: 202
- Joined: Mon Dec 05, 2016 12:32 am
- Location: Portugal
- Has thanked: 17 times
- Been thanked: 38 times
Re: Arduino Leonardo pro micro
ok, i was reading through the HHBatteryMonitor.py and found this part:
So this is converting to a voltage value again?
I mean, in the lotusalex2000 code, he uses the same readserial() to convert it to actual voltage, so this script is redoing it again? but didn'n readserial() changed coming from the arduino instead of the supposed ads1015 (which i think this was made for)?
Or i'm wrong (and now you can tell i dont know programming, or how leonardo outputs data)
SpoilerShow
def convertVoltage():
global VCC
sensorValue = readSerial()
voltage = float(sensorValue) * (VCC / 1023.0)
return voltage
global VCC
sensorValue = readSerial()
voltage = float(sensorValue) * (VCC / 1023.0)
return voltage
I mean, in the lotusalex2000 code, he uses the same readserial() to convert it to actual voltage, so this script is redoing it again? but didn'n readserial() changed coming from the arduino instead of the supposed ads1015 (which i think this was made for)?
Or i'm wrong (and now you can tell i dont know programming, or how leonardo outputs data)
________________________________________
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
-
- Posts: 27
- Joined: Sat Dec 29, 2018 8:21 pm
- Been thanked: 7 times
Re: Arduino Leonardo pro micro
I'm in the middle of my build using a Pro Micro and have reference this thread a lot. It has been a huge help to me, hopefully I can pass on some assistance.
First, I'll try and answer your last question about the code and voltage conversion. I'm assuming you are using the last bit of code he posted that incorporates the battery monitor (July 28, 2017 at 2:17pm). That is what I have gotten to successfully work for both the battery monitor and gamepad detection. The way the Arduino code works is that when the Raspberry Pi sends a "1" over the serial line, the Arduino responds with sensorValue. This is the raw digit format for an analog signal (0-1023). The part about the voltage conversion in the Arduino sketch was likely to print out on the serial monitor for testing purposes. If you look at the code, the line for displaying the voltage ("//Serial.println(voltage);") begins with the "//" characters, which changes it from an actionable part of the code to straight text. When I was testing my setup directly on the computer, I removed the // so I could see the reading and track it against the actual voltage. As it sits in the code now, that portion could be deleted if it is causing confusion.
First, I'll try and answer your last question about the code and voltage conversion. I'm assuming you are using the last bit of code he posted that incorporates the battery monitor (July 28, 2017 at 2:17pm). That is what I have gotten to successfully work for both the battery monitor and gamepad detection. The way the Arduino code works is that when the Raspberry Pi sends a "1" over the serial line, the Arduino responds with sensorValue. This is the raw digit format for an analog signal (0-1023). The part about the voltage conversion in the Arduino sketch was likely to print out on the serial monitor for testing purposes. If you look at the code, the line for displaying the voltage ("//Serial.println(voltage);") begins with the "//" characters, which changes it from an actionable part of the code to straight text. When I was testing my setup directly on the computer, I removed the // so I could see the reading and track it against the actual voltage. As it sits in the code now, that portion could be deleted if it is causing confusion.
First Build Done! viewtopic.php?f=43&t=7444
-
- Posts: 27
- Joined: Sat Dec 29, 2018 8:21 pm
- Been thanked: 7 times
Re: Arduino Leonardo pro micro
Secondly, it appears you have the HoolyHoo script correctly installed because you are seeing the battery monitor on the screen. Here is how I confirmed proper function of my setup after verifying the Arduino was properly tracking voltage.
For the first test: with your breadboard, connect your analog pin (A0 is what is used in the code - if you use a different analog pin that needs to be changed) with a jumper wire to one end of a 10k resistor. At the other end of the resistor, connect another jumper wire. This wire will be connected to either VCC or ground on the Arduino as you run the test. Now, the Arduino is connected to your computer via USB, Arduino IDE software installed and running. Properly select your board from the Tools menu (Arduino / Genuine Micro) and port. Open up the Serial Monitor (magnifying glass on the top right of the screen). With the end of the jumper wire from the resistor not connected to anything, type "1" (no quotes) in the top portion of the window and click send. There should be a random number printed in the serial monitor between 0 and 1023 generated as the analog pin is in float. If you see a number, that means your code is correct and the Arduino properly working. Now connect the jumper wire from the resistor to VCC. Type "1" again. This time, 1023 (or a number close to it), should appear. That is the 5v reading. Finally, remove the jumper from VCC and connect it to the GND pin of the Arduino. Type "1" again. You should see 0 in the serial monitor.
Assuming you see these values, it is time to connect the Arduino to the pi. To remove any variables, connect it via the USB port via adapter. Connect the jumper again to a 5v source. I'm currently using a 5v PSU to power everything as I am testing all the components individually before finalizing assembly. You could also just use the VCC on the Arduino I'd think. Boot up the pi and you should see the full battery icon. Assuming you do, remove the jumper from VCC and connect to GND. The icon should quickly change to an empty battery with a single red line and the countdown begin a few seconds later.
Hope this helps! Took me a couple of days to parse all this together and I have a basic understanding of Arduino code from other projects.
For the first test: with your breadboard, connect your analog pin (A0 is what is used in the code - if you use a different analog pin that needs to be changed) with a jumper wire to one end of a 10k resistor. At the other end of the resistor, connect another jumper wire. This wire will be connected to either VCC or ground on the Arduino as you run the test. Now, the Arduino is connected to your computer via USB, Arduino IDE software installed and running. Properly select your board from the Tools menu (Arduino / Genuine Micro) and port. Open up the Serial Monitor (magnifying glass on the top right of the screen). With the end of the jumper wire from the resistor not connected to anything, type "1" (no quotes) in the top portion of the window and click send. There should be a random number printed in the serial monitor between 0 and 1023 generated as the analog pin is in float. If you see a number, that means your code is correct and the Arduino properly working. Now connect the jumper wire from the resistor to VCC. Type "1" again. This time, 1023 (or a number close to it), should appear. That is the 5v reading. Finally, remove the jumper from VCC and connect it to the GND pin of the Arduino. Type "1" again. You should see 0 in the serial monitor.
Assuming you see these values, it is time to connect the Arduino to the pi. To remove any variables, connect it via the USB port via adapter. Connect the jumper again to a 5v source. I'm currently using a 5v PSU to power everything as I am testing all the components individually before finalizing assembly. You could also just use the VCC on the Arduino I'd think. Boot up the pi and you should see the full battery icon. Assuming you do, remove the jumper from VCC and connect to GND. The icon should quickly change to an empty battery with a single red line and the countdown begin a few seconds later.
Hope this helps! Took me a couple of days to parse all this together and I have a basic understanding of Arduino code from other projects.
First Build Done! viewtopic.php?f=43&t=7444
- correia5022
- Posts: 202
- Joined: Mon Dec 05, 2016 12:32 am
- Location: Portugal
- Has thanked: 17 times
- Been thanked: 38 times
Re: Arduino Leonardo pro micro
Hey, thanks for the good explanation!!
Today i made all the tests you mentioned, i was about to register it here.
I read some guides on adafruit website about arduino and got some ideas of code structure
the first part of uncomment both the Serial.println(sensorValue) and Serial.println(voltage) was successfull. I monitor both values in the window and work very well. So i can assume the code is working ok
Then i wired it to the pi and again the monitor state doesn't change...
________________________________________
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
- correia5022
- Posts: 202
- Joined: Mon Dec 05, 2016 12:32 am
- Location: Portugal
- Has thanked: 17 times
- Been thanked: 38 times
Re: Arduino Leonardo pro micro
2nd try on the matter.
I was wiring the pi through my pc's usb3 port.
Also using a hub with sound card, keyboard and wifi
Got the reading and cases:
VCC/RAW = 4.06v
A0 @3.34v get full battery bar
@3.11v full bar
@2.41v shutdown starts
So, removed everything, wired the leonardo directly to microusb via otg
Powered by powerbank
VCC=4.5v
A0 @3.67v full bar
@3.36 full bar
@2.76 shutdown
I can only assume something's wrong in the monitor script?
Any way i can monitor the variables through ssh?
Next try, fresh retropie flash and install script again... :/
I was wiring the pi through my pc's usb3 port.
Also using a hub with sound card, keyboard and wifi
Got the reading and cases:
VCC/RAW = 4.06v
A0 @3.34v get full battery bar
@3.11v full bar
@2.41v shutdown starts
So, removed everything, wired the leonardo directly to microusb via otg
Powered by powerbank
VCC=4.5v
A0 @3.67v full bar
@3.36 full bar
@2.76 shutdown
I can only assume something's wrong in the monitor script?
Any way i can monitor the variables through ssh?
Next try, fresh retropie flash and install script again... :/
________________________________________
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
Starting on electronics
My first build, 2 years later
https://sudomod.com/forum/viewtopic.php ... 8&start=30
Check out my Boombox: https://nrcboombox.wixsite.com/website
Who is online
Users browsing this forum: No registered users and 1 guest