-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for RP2040 / Pico #115
Comments
@mattjlewis : Thanks for providing and testing this. I'll be looking forward to a PR. Did you use the Arduino IDE with https://github.com/earlephilhower/arduino-pico for programming the pico or some other way? |
It's great to see new features being added to Firmata.
|
The first problem was fixed by adding
|
@mattjlewis May I ask: How to read built-in Temperature ?Tried to read A0, A1, A2 -> all = ca. If I use this math formula for A3 (510) the result is ca. -400. PS: I'm using Node-Red's built in "Arduino" module for reading the values. |
@PizzaProgram It seems that the python library you copied that information from does some stuff "behind the scenes". If you look at this code, you see that an additional |
@pgrawehr Thank you for the tips and the quick answer! I've copied these lines to the init void, but nothing changed: void setup()
initTransport();
Firmata.sendString(F("Booting device. Stand by..."));
initFirmata();
adc_init();
adc_set_temp_sensor_enabled(true);
// Select ADC input 4 for internal temperature sensor
adc_select_input(4);
A0, A1, A2 are continuously changing if I pull my finger over them (to shorten the circle) between 0-1000.
It is not, that I could not reduce the amount of values printed, but I guess it is also using the whole bandwidth of Firmata's 57Kbaud, which will be problematic if I want to use other things on the same connection._ |
@mattjlewis PS: did you see this? #176 Can you maybe Reopen this issue? (So other can see it too, and maybe give any ideas?) |
@PizzaProgram Maybe you create a new ticket instead. This old one was for the general support for the RPI Pico, your issue is "only" related to analog input. The overloading seems to be an issue of the client, as the communication can easily catch up with 24msgs/sec. A single analog message transmits only 3 bytes. |
On the other hand... The range of the values is limited to 14 bits in the protocol. Can you check what the actual reading would be? Maybe it's just cutting of the 2 top bits. What is the reported value of the ADC resolution in the cabability query? |
I don't really think, spamming issues would help. The temperature chip is part of RP2040. So it should be part of "Support for it", as the topic here says. Please reopen the ticket, so other may see it ;-) I was also thinking about how to address a query to the whole firmata community to suggest:
It is probably true. But that means, if a Reading the chip's temperature value more than 4x / sec would be absolutely unnecessary in any cases, so this limit could be hardcoded here for this specific pin from the beginning as default frequency. |
I was searching for the answer for weeks now, but did not find it. Sorry. EDIT: |
I wonder:
Should not all analogue ports reporting float values? |
No, that won't work directly. The problem is that the protocol only transmits a 14 bit integer for each ADC reading. The conversion to float happens after that, in software. All known boards report ADC values as integers, because that is technically easier. The value needs to be interpreted as parts of the full voltage range. Can you please try to flash this program to the RPI and see whether the console output shows reasonable temperatures? If so, can you print the value of the |
I believe this to be the board definition for a standard Raspberry Pi Pico device, it would be great if this could be incorporated:
I've done basic tests with the above using DIGITAL_INPUT, DIGITAL_OUTPUT and I2C.
The text was updated successfully, but these errors were encountered: