…
At some point I think I lit on the possibility of using the Arduino IDE to program the pico, but I’ve gone off on so many tangents with all this that it got lost.
The advantage of the Arduino IDE is that it’s specifically designed to simplify programming microcontrollers. A lot of difficult detail is hidden behind the scenes, allowing programmers to concentrate on writing code, not spending days setting the environment up.
I revisited the Arduino IDE and did indeed see ‘Arduino Mbed OS RP2040 Boards -> Raspberry Pi Pico’ in the ‘Board’ menu. I tried with ‘Blink’ which seemed to compile / build OK, but gave an unhelpful ‘Error Uploading’ message.
The upload failed because the Pico wasn’t in BOOTSEL mode. Most boards programmed by the Arduino-IDE switch automatically into upload mode, but despite claims it should after first connect, I find my RP2040 doesn’t. It’s important to get this right, Adafruit’s instructions has a little video!
I then installed the RP2040 package from Earle Philhower and all went well. So, focusing on the Pico route possibilities seem to be:
- Arduino IDE + the EarlePhilhower RP2040 board package. If the various Arduino libraries for specific peripherals work this looks to be the easiest way forward. Dave’s result with the DS18B20 is encouraging.
I’d rather stick with the Arduino teams standard package. Could be wrong, but I think it’s better supported in terms of advice and libraries. Low risk – if EarlePhilhower lets you down, not difficult to go back.
- RP’s own Pico SDK. This allows building executables from source using the command line. The SDK provides scripts for processing source using both CMake and Bazel which are industrial strength tools designed to allow compiling/linking code written in a variety of languages for a variety of target platforms. So necessarily complex. Not trivial to get to grips with (for me at least), but allows direct access to the comprehensive SDK.
Extremely complex. The Arduino-IDE is designed to be beginner friendly, and it’s a good learner platform. The Pico-SDK does much more than the Arduino-IDE but the beast isn’t intended for beginners!
- Various IDE tools (eg VScode, as recommended by RRi). These are GUI ‘wrappers’ for CMake &c so far as I can make out. I had zero success with them despite spending quite a lot time trying. In the link I gave earlier Lief Koepsel says: … If you develop code for living, by all means, use the tool of professionals, an IDE. If you are experminting/learning/hacking, focus on the project not learning how to use an IDE.“
That’s good advice. Professional programmers don’t like the Arduino-IDE much because it doesn’t let them change what goes on behind the scenes. Though it might matter to a pro which ‘make’ tool is used, the average Joe is unlikely to care.
…
Dave: I actually have a DS18B20 which I got working fine with a Nano and the DallasTemperature library. It’s impressive for such a cheap device. I got 0.3-0.4 C in an ice/water bath which gave 0-0.2 C using a PT100 resistance probe. Good to hear you got it going with the Pico. I was planning to use PT100s which work well with the Adafruit MAX31865 board, but not with the cheap (<£5) clones which were up to 2C out when they worked at all. These all use SPI – I’d be interested to hear of any results using SPI on the Pico.
There is a Pico library in the Arduino Library Manager that supports the PT100, called RAK12022-MAX31865. Details on github here. SPI should work on the pico – there’s a standard library – #include <SPI.h>
Robin.
Further to my DS18B20 experiment, I connected three sensors in parallel to see if the library detects that automatically. It does. DS18B20 sensors have a unique address, that the library presumably detects by scanning the bus when the program starts. The example program prints results like this:
The program identifies particular sensors by ‘deviceIndex’.
Oh, and Mark’s warning about fakes might explain why my device 2 consistently reads a degree low! Hmmm…
Dave