Juxen

Raspberry Pi Pico

Raspberry Pi has released a new microcontroller board, the Pico. It's more akin to an Arduino board than a Raspberry Pi computer, where you load code (MicroPython or C++) onto it, and it starts working away when it is plugged in. MSRP is $4, although I'm seeing some at my local Micro Center for $2 per board, making them incredibly cheap. Wifi and Bluetooth are not on this little board. Power consumption is virtually nonexistent, with 0.006 W in sleep mode and 0.33 W running full-out.

Again, like Arduino microcontrollers, this should be capable of running lights or animations on a layout, instead of dedicating a Raspberry Pi to do the job. It should be mentioned that the Pi Zero, an actual computer, costs $5 with no wifi or BT, and $10 for the Pi Zero, which does have wifi and BT.

The Pico is capable of reading from sensors and making decisions based on those sensors; the below YouTube video shows the board being used to monitor temperature.

 

Reply 0
George Sinos gsinos

Adafruit's video

Here's a little longer video from Adafruit, with information on their Feather format versions.  gs

 

 

Reply 0
John P

Not for inexperienced users!

The trouble with this component, from most people's point of view, is that it doesn't have an easy interface with a computer running a common operating system. Unlike the Arduino, for instance, which was designed to make it easy for non-technical people to use. There may be some improved interfaces coming, though, including the possibility of getting it working in the Arduino environment. You can read what people are saying about it on a forum for Raspberry Pi users:

https://www.raspberrypi.org/forums/viewforum.php?f=143

The Micro Center chain of stores stocked the Pico at a price of $2.00 per unit. Some of the outlets sold out their stock almost instantly, and others still have them listed. I think it depends on the number of hackers in the immediate vicinity, but I can't help wondering how many purchasers have actually done anything with them!

Reply 0
Geoff Bunza geoffb

RPi Pico... The good the bad and the ugly...

Hi,

I spent the last weekend messing with a couple of new Pico's. I purchased a few because for $4.00 a piece they are a very fast (8.3 X faster than most Arduinos), dual core Arm processor, with 4 built in SPI interfaces for displays, pin expanders, complex sensors, and such, and more memory also. They are not as fast nor capable as a Teensy4.1, but they are cheaper. I saw some good potential in these. They have the potential for better, interactive debugging tools (not available yet) too.

If you are a fan of programming yourself in MicroPython (another computer language) the development environment using "Thonny" works fairly well, and is as convenient as the Arduino IDE for making changes and iterating through your designs. There are even library packages available, though most are not directly applicable to model railroading, nor as well documented. Python suffers from many of the same foibles as Jython scripts used in JMRI (which I consider to be a sometimes necessary evil!!!),

If you are looking for C/C++ support, there is a Software Developers Kit (SDK) with one of the more obtuse set of instructions to set up a Microsoft VS Code environment that I have seen in years. This gets you to edit and translate (compile) C/C++ for the pico... and then load it with such a primitive transfer mechanism that you wonder why they even bothered... almost as ugly as either set up described above.

The really bad thing for most modelers who don't want "software as a second language" is the lack of great library support, which will likely differentiate Arduino-library compatible machines for some time to come.

The Arduino folks have announced plans to develop their own processor board based on the same RP2040 microcontroller used in the Pico. It may well happen that some support for the Pico itself, including some library conversion may come along too. I suspect that the popularity of the Pico could easily compel some to develop a much more user friendly setup and development environment independently -- time will tell.

The low price together with the jump in capability sets a new reference point for the RPi Pico. It's just not quite ready/mature for most modelers. For $4 its worth a closer look. 'Just one modeler's opinion.

Have fun! 
Best regards,

Geoff Bunza

Geoff Bunza's Blog Index: https://mrhmag.com/blog/geoff-bunza
More Scale Model Animation videos at: https://www.youtube.com/user/DrGeoffB
Home page: http://www.scalemodelanimation.com

Reply 0
George Sinos gsinos

Big Picture

I think this makes a tremendous amount of sense from the "big picture" point of view. I use the term loosely

Arduino is an Italian organization that developed their hardware for the education market. It uses the C/C++ based language.  That made perfect sense for the time period as the low cost hardware did not have a lot of power.

The Raspberry Pi foundation is a similar British organization.  The Raspberry Pi computer was also developed for the education market.  Being an actual single board computer with more power it could successfully use the Python language.

Now, coming along much later, as micro-controller hardware has become cheaper and more powerful, the Raspberry Pi Pico slots into the same category as the Arduino.  But, being more powerful it can use the Micro--Python interpretive language. Similar enough to Python, that from an education perspective you can learn "one language" for both a micro-controller and a full fledged computer. 

Even though the Arduino group will support the RPi Pico, it's my guess that The Raspberry Pi foundation will be pushing Micro-Python as the native environment.  

Then there is Adafruit that has been developing their open source version of Micro-Python, called "Circuit Python,"  for a few years now. From the experimenter's standpoint, there isn't much difference between the two.

Adafruit libraries (well over 200) for Arduino make up a very large portion of the software libraries out there, and they have updated most of them to support the Pico already.  So there is a lot of support for the Pico.

Circuit Python, in particular, is open source.  So many manufacturer's have produced compatible hardware.  When I grabbed this link, the total was 173 boards. You can see them here

The Circuit Python libraries can also be used on single board computers.  That list is here.

I think the story isn't which is better.  It's like everything else in the computer world.  There is a choice of languages and architectures.

I'm pretty sure the Pico is targeted at the python world.  But the Arduino IDE will eventually support it for those that would like to use the C/C++ environment.

It's good to have choices.

gs

Reply 0
John P

I actually got a couple!

As I said, Micro Center has been selling the Pico for a rock bottom price, and they just got some new stock at the Cambridge MA location, so I headed down there in the aftermath of a blizzard (which wasn't as bad as predicted, but it kept people off the roads) and picked up a couple. I'm hoping that people smarter than I am will figure out ways to unlock the power of these devices for the non-expert user! Geoff, your experience was pretty much what I expected, but I'm encouraged by the fact that you're looking at this. I'm hoping that you'll not only succeed in getting the Pico working, but you'll tell us how you did it.

So far Raspberry Pi's products have really been computers on a little board. The Pico is a microcontroller, not made to interact with a display or keyboard, but able to connect with external devices. The Arduino group was brilliant in creating a product which was easy to use both in its interface on the computer, and in coding the device itself. The Pico looks as if it could do the same, if someone can provide the software.

I've done a lot of work with PIC processors and recently a little on the Arduino. MicroPython doesn't look too bad, but I'd stick with C if I could. What I don't feel able to do is set up a programming environment, so that's what I'll be looking for.

Edited to say I just downloaded Thonny. There's a start.

Reply 0
Juxen

Grabbed a few

Grabbed a few from Micro Center as well ($2 a piece). Haven't really played with them yet, as I'm still trying to learn Python from ground zero before I dive into this. My first project that I aim to do is to use a Pico (with light sensor attached) notice when the ambient light has been turned off, then turn on and off different LED's at random times, intervals, and locations. I'm hoping that, inside of a house, this will simulate a "coming home from work" evening routine, fading into the late night when all the lights in the house turn off.

Reply 0
George Sinos gsinos

Free MicroPython Book

You can download a PDF of the book "Get Started With MicroPython on the Raspberry Pi PICO" here.

Of course, you can buy a hardcopy at the same place.   It's written for kids, but it seems adults can use it too. 

I'd just get the PDF for now, there are errors that will likely be corrected in future printed editions.  Or they may just post the corrections on the web site.  The PDF version has already been corrected.

GS

Reply 0
John P

Not very impressive with MicroPython!

Of course I had to give my new Picos a try. And I have to say, running the example code with Thonny (on a Windows 10 PC) was very easy. And so far MicroPython is simple enough! I thought I'd try a test of the most basic microcontroller function, changing the state of a pin a few times so I can see it on a scope. So I took one of the example programs and modified it like this:

from machine import Pin, Timer
led = Pin(25, Pin.OUT)
test = Pin(2, Pin.OUT)
timer = Timer()

def blink(timer):
    led.toggle()
    test.value(0)
    test.value(1)
    test.value(0)
    test.value(1)
    test.value(0)
    test.value(1)

timer.init(freq=1000, mode=Timer.PERIODIC, callback=blink)

What it does is to set GPIO pin 2 (which is pin 4 on the PCB) low and then high again 3 times in succession, with the pattern repeating at a 1000/sec rate. The result was that the 1000Hz loop ran pretty accurately. But the 3 lowgoing pulses and the high periods between them showed a lot of jitter, and typically, each high or low interval was about 8usec long. That's not very impressive for a Dual-core Arm Cortex-M0+ @ 133MHz! And no need to worry about whether my scope would be fast enough to show anything. Somewhere I read a claim that C would run 1000 times faster than MicroPython; if that's true, it would start to look interesting
 
Reply 0
sonnybalut

raspberry pi pico dcc signal generator

Just sharing code for a dcc signal generator using micropython, you tube demo here -->  

  source in the description.

 

Thanks,

Sonny

Reply 0
Ted Becker rail.bird

What would you use it for?

What would you use it for on a model railroad?  What task* associated with a model railroad needs the computing horsepower provided by a Pi Pico?  Ignore some peripheral features and the Pi Zero out performs the Pico at about the same price.

*Let's qualify that to embedded controller task.  Running JMRI or generating train orders doesn't count. 


Ted Becker

Granite Falls, WA

Reply 0
riogrande491

Not sure I will ever use a PI

I'm an experienced C++ programmer, and I freely admit that the Arduino/Teensyduino tool chain has me spoiled. There are so many great libraries. I don't have to spend hours reading processor data sheets to figure out housekeeping stuff such as how to set up timers, I2C, SPI and so forth. Through the efforts of others smarter than myself I can remain focused on just the model railroad problem I want to solve.

On a friend's huge layout a $20 Teensy 3.2 runs his 32 live-column hardware US&S CTC machine. In terms of CPU, RAM and ROM utilization the 96 MHz ARM Cortex M4 processor has far more horsepower than needed to solve the problem (remember that the prototypes originally did all this with relays!)

5 Teensy 3.5s have replaced PIC processors on C/MRI SMINI cards, allowing me to modify the communications protocol to be far more robust in the presence of DCC noise on the 485 bus. Today's Teensy 4/4.1 are faster but the 3.2 and 3.5 still have 5 Volt tolerant logic pins. Faster would be of no benefit, since between I2C and 485 timing is I/O limited. I don't know if the PI Pico is 5V tolerant, but if not that alone would be a deal breaker.

Several 5 Volt Arduino Pro Minis run route-selection control panels and a synchronized lightning/thunderstorm generator. 32 CTC controlled switches each have a $1 ATTINY85 for arbitration between CTC and local control. Dozens of ATTINY85s run optical detectors for hidden staging tracks. 

All of this is done with one free and familiar tool chain in the C++ language. Learn once, deploy everywhere.

That said, I do respect those who want to explore the latest hardware. 

Regards,

Bob

 

 
Bob
Appalachian & Ohio Signal Department
Reply 0
John P

What I'd like to use it for

I have several LCD panels, 640 by 480 pixels, which I'd like to use as display screens at various points around our railroad where there are complex switches. I've already installed one to operate one end of the main freight yard, with an added touchscreen overlay. This works using a PIC16F1877A processor and a fair amount of external hardware, because the screen has to be refreshed at a 70Hz rate and data fed into it at 6MB/second at intervals. I think the Pico could do it all--hold the data for an entire screen internally, update it as needed, run the horizontal and vertical sync pulses for the screen and output the data in the right sequence. Oh, it would be so elegant!

It wouldn't really be a question of processing power, but having a large internal memory and delivering data at a fast rate when needed. I think the Pico might be ideal for that.

Reply 0
falkenrr

Agree with Geoff for now

The Pico looks very powerful, but it is a bit early in the lifecycle of things to be usable by folks who are not software/firmware hackers right now.

The amount of hardware which you get for $4 is pretty amazing: Dual ARM M0 processors, and several "PIO" modules capable of generating time critical sequences, such as talking to "NeoPixel" LEDs or even generating the DCC waveform to connect to a booster (as an earlier posted linked),

I just got a few Picos to play with earlier this week.

-Dave Falkenburg
 Silicon Valley Lines

Reply 0
John P

C now available using the Arduino environment!

You can now program the Pico in the Arduino environment, but the process was figured out by a third party, not the Raspberry Pi or Arduino organizations. The software to do it is fairly straightforward to install, although it involves some substantial downloads. I successfully used the instructions here:

https://www.tomshardware.com/how-to/program-raspberry-pi-pico-with-arduino-ide

I've verified that this really works with C code. Executing this sequence (set a pin high then low) 20 times in succession takes about 320nsec, which would be 8nsec per operation, though it's outrunning my modest scope's ability to display it:

gpio_put(2, 1);
gpio_put(2, 0);

Edit to say I ran into one snag. What happened was that I bought 2 Picos and used one for testing MicroPython, while the other one went onto a shelf unused. Then later I plugged the used one into the computer with Arduino running, and it was totally unresponsive. Not panicking, I got the virgin unit out, and it worked perfectly. There's probably a procedure to restore a Pico to factory condition, but I haven't tried to find it.

Reply 0
Reply