Jump to content
 

Raspberry Pi Pico


DavidB-AU
 Share

Recommended Posts

  • RMweb Premium

I use a bespoke Vero spot face cutter to break tracks on stripboard. This

The cutting angle is shallower than a drill bit, but if you have a grinder you could always re-angle any suitable drill, although as they are they're not too bad.

 

I usually use fibreglass board, it's way stronger than the usual SRBP type but it is hard on cutting tools (also for some reason tracks seem less likely to lift if overheated with the soldering iron)

Link to post
Share on other sites

7 hours ago, backofanenvelope said:

Thank you David and Melmerby.

 

That’s just what I was looking for. A friend gave me an arduino kit last Christmas and I had no idea what to do with it or all the bits that came with it. I now have the basis for my project with Pico and breadboard to try out a servo control app.

Hi,

 

The Pico is not a particularly good fit with servos as most servos require a 5V control signal and the Pico only outputs up to 3.3V. Many Arduinos have 5V I/O.

 

Regards

 

Nick

  • Agree 1
Link to post
Share on other sites

Just now, backofanenvelope said:

Hi Nick,

 

My understanding is that I can power servos from the adafruit boards 5v input, or am I misunderstanding this? I am completely new to the world of electronics..

Tom

Hi,

 

Its the voltage of the control signal that goes from the MCU to the servo that I was concentrating on. A servo normally has three wires. Normally 5V, a control signal and 0V.

 

Regards

 

Nick

 

 

Link to post
Share on other sites

  • RMweb Premium
2 hours ago, NIK said:

Hi,

 

The Pico is not a particularly good fit with servos as most servos require a 5V control signal and the Pico only outputs up to 3.3V. Many Arduinos have 5V I/O.

 

Regards

 

Nick

They might work with 5v supply and 3.3v signal.*

The 3.3v In/Out could be a bit of a let down as some modules for the Arduinos use 5v so couldn't be a direct swap.

I was going to try doing one or two things from a Nano land to give the Python language a bit of a go.

But unless they are 3.3v compatible (some are), I can't

 

Edit

*On the Polulu website they suggest a 3.3v signal is fine with a 5v servo supply.

"Pulse voltage

As we saw in the RC receiver output signals from last time, the pulse voltage can vary quite a bit. Modern receivers have 3.0 V signals, but many servo controllers use 5.0 V or more. For the most part, this signal amplitude does not matter too much, as a long as it is high enough for the servo to register the pulses, and the valid range is perfect for interfacing directly to a microcontroller that is running at 3.3 V or 5.0 V. We put 220-ohm resistors in line with the outputs of our servo controllers, which run on approximately 5.0 V; the resistors protect the pins in general but also prevent too much current from flowing in the event that the servo is running at a lower voltage than the signal it is getting."

Edited by melmerby
Link to post
Share on other sites

4 hours ago, DavidB-AU said:

Driving any sort of motor from a 3.3V GPIO pin is relatively simple. This is a circuit for driving a 12V motor from a Raspberry Pi.

 

A2syM.jpg

This will work but only for fairly low power motors. I think it will struggle to provide much more than approx. 130mA

Link to post
Share on other sites

  • RMweb Premium
1 hour ago, LimboBrit said:

This will work but only for fairly low power motors. I think it will struggle to provide much more than approx. 130mA

Depends entirely on the transistor.

However the position signal to a servo requires very little current as it is a logic signal. The power for the motor comes from it's 5v supply

  • Agree 2
Link to post
Share on other sites

7 hours ago, DavidB-AU said:

Driving any sort of motor from a 3.3V GPIO pin is relatively simple. This is a circuit for driving a 12V motor from a Raspberry Pi.

 

A2syM.jpg

 

It might be better to use an L298N based motor driver board than a discrete transistor.  They're not that expensive,  they have better protection features than the simple circuit above and are fairly easy to set up.

 

Typical L298N board for reference

 

NOTE

On second thoughts, treat that suggestion with caution for now.  I'd forgotten that L298N implementations use 5v logic (I'm used to using them with Arduino Unos) and coupling them to a Pico might fry the Pico, which uses 3.3v logic, although I've just seen a project description using an ESP32 board which apparently uses 3.3v logic.

 

Any suggestions?

 

 

Edited by Hroth
A hiccup
  • Agree 1
Link to post
Share on other sites

1 hour ago, melmerby said:

Depends entirely on the transistor.

However the position signal to a servo requires very little current as it is a logic signal. The power for the motor comes from it's 5v supply

Agreed, the 2N2222 is not a power transisistor. The circuit shown is not driving a servo but a 12V DC motor and the motor current is being switched through the transistor. A low threshold voltage FET may be a better choice.

Link to post
Share on other sites

  • RMweb Premium
41 minutes ago, Hroth said:

 

 

 

 

On second thoughts, treat that suggestion with caution for now.  I'd forgotten that L298N implementations use 5v logic (I'm used to using them with Arduino Unos) and coupling them to a Pico might fry the Pico, which uses 3.3v logic, although I've just seen a project description using an ESP32 board which apparently uses 3.3v logic.

 

Any suggestions?

 

 

If the 5v is just logic input to the driver board, there shouldn't be a problem as long as the Pico has a 3.3v supply.

In many cases items that use 5v logic will still work with a 3.3v "high" signal

I can't remember what the actual figures were or are but with 5v logic I seem to think a high was over 2.8v and low was less than 1.8v.

The device specification should have this info, somewhere.

  • Agree 1
Link to post
Share on other sites

1 hour ago, Hroth said:

On second thoughts, treat that suggestion with caution for now. 

Well, there are other Motor & Servo control HATs available for the Pi, including ones explicitly designed for the Pi Zero.

 

e.g.  https://thepihut.com/collections/raspberry-pi-motor-servo-hats/products/motozero

 

A bit more expensive than the previous linked one, but it does handle up to 4 motors.

 

Yours,  Mike.

  • Like 1
Link to post
Share on other sites

  • RMweb Gold

This site has some useful background on 3.3 to 5.0 volt level shifting between differing logic family technologies : -

 

https://hackaday.com/2016/12/05/taking-it-to-another-level-making-3-3v-and-5v-logic-communicate-with-level-shifters/

 

The RP2040 I/O capability is a major area of concern for me.

I am used to (spoiled!) the PIC family of Microcontrollers and, as time passed, their pin I/O capability increased.

It's not just 3.3 to 5 volts, it's also the Sink/Source capability that allows the PIC to easily interface to the outside world.

 

I've ordered 5 of these of Ebay for £5.50 :-

 

image.png.3ed2d2d2492da48ddb593e955afdb6c4.png

 

I'll have a play with them on the I2C lines as that way I can interface to my 5volt world through Expanders.

 

 

Kev.

  • Like 1
Link to post
Share on other sites

3 hours ago, SHMD said:

This site has some useful background on 3.3 to 5.0 volt level shifting between differing logic family technologies : -

 

https://hackaday.com/2016/12/05/taking-it-to-another-level-making-3-3v-and-5v-logic-communicate-with-level-shifters/

 

The RP2040 I/O capability is a major area of concern for me.

I am used to (spoiled!) the PIC family of Microcontrollers and, as time passed, their pin I/O capability increased.

It's not just 3.3 to 5 volts, it's also the Sink/Source capability that allows the PIC to easily interface to the outside world.

 

I've ordered 5 of these of Ebay for £5.50 :-

 

image.png.3ed2d2d2492da48ddb593e955afdb6c4.png

 

I'll have a play with them on the I2C lines as that way I can interface to my 5volt world through Expanders.

 

 

Kev.

Hi,

 

I've used one of those level converter boards with a 3.3V Blue Pill development board clone.

 

I read the other day that the total current capacity of the IO of the RP2040 chip in the Pico has been clarified as being 50ma max (12ma max for individual outputs). The datasheet is to be updated.

 

I've managed to get the Pico PIO to fade in and out 4 Aspect Colour Light Signal lights (low current LEDs). A C program just initialises the PIO partly using a .pio.h file that contains in this case instructions for two state machine programs, then the C program runs the main loop telling the PIO what LEDs to fade in and out as per a prototype signal.

Multiple state machines can run the same instructions which is just as well as each of the two PIO blocks can contain only 32 state machine instructions.

The idea was to demonstrate part of the PIO could be used to save on RC filter components or CPU time.

The C program could have been written in MicroPython and would have been easier but it would have run much slower. Plus I wanted to practise uploading C programs to the Pico via the SWD interface from Visual Studio Code.

 

 

Regards

 

Nick

Edited by NIK
  • Like 1
Link to post
Share on other sites

  • RMweb Gold
5 hours ago, LimboBrit said:

The data line of I2C is bidirectional 

 

Yes, so are those little 4way level shifter boards.

I'm sceptical about their performance, which is why I am trying them on the I2C lines as I want to check their bandwidth as well as function.

 

 

Kev.

Link to post
Share on other sites

  • RMweb Gold

My Pico is running...

 

20210209_203508.jpg.4a0cc5cda462eaae5113b7146fdcbaae.jpg

 

As you can see, it is running on a little "pico explorer" board from PIMORONI costing just over £22 inc VAT.

 

When I bought it I didn't realise it had a DRV8833 dual H-Bridge IC on it as well as the breadboard, 2 Breakout connectors and the OLED display!

 

"Hello World!" and the blinking LED routines are already done.

(...all be it via the command line interpreter via CoolTerm over the USB.)

 

 

Kev.

  • Like 3
Link to post
Share on other sites

On 07/02/2021 at 05:42, DavidB-AU said:

 

 

 

The Pi Pico starts to blur the line a bit. It can control electronics but it's fast enough and powerful enough to do some number crunching if desired and can be programmed in Python or C/C++. It is in the order of 100 times more powerful than a 1980s home computer. But it doesn't quite have the flexibility of a standalone computer, will only run one program at a time and doesn't have any graphical output.

 

Cheers

David

I need a bit of helpful explanation  from an expert  for this, the Pi Pico has 4 cores,  can each core be programmed work independently of the others?  ie each core run  object code so that 4 cores can run 4 individual files of  object code?  Also does the answer lead to an explanation of multi- threading?

 

Note : Hackspace  Magazine with free device on the cover, of the two  WH Smith shops on Waterloo Station concourse,  the major of the two shops had copies  on the shelf this morning, (10/02/21), 

Link to post
Share on other sites

1 hour ago, Pandora said:

I need a bit of helpful explanation  from an expert  for this, the Pi Pico has 4 cores,  can each core be programmed work independently of the others?  ie each core run  object code so that 4 cores can run 4 individual files of  object code?  Also does the answer lead to an explanation of multi- threading?

I'm a bit wary of diving in here, since this could turn into a very long conversation :blink:

 

The main documentation page for the Pico is here:

https://www.raspberrypi.org/documentation/pico/getting-started/

- the slightly alarming thing is that this stuff is still steaming in the morning air - the last update I saw is marked as Feb 1 2021... However, it is where you should start.

 

In many ways, it is perhaps best to look at the SDKs since these really dictate what most folks will do with the Pico - they have C/C++ and Python SDKs available. Choose your poison...

 

Now, the Pico claims to have a main processor with 2 cores ("Dual-core Arm Cortex M0+ processor") - BUT the Pico is a microcontroller and so it ALSO has 2 PIO blocks (PIO = Programmable IO), each of which has 4 state machines and these deal with I/O. (See Chapter 3 here: https://datasheets.raspberrypi.org/rp2040/rp2040-datasheet.pdf).

 

 

So each core on the main processor can execute one program at one time - so 2 cores implies potentially 2 different programs at the same time. But since the Pico is all about controlling IO, it is those PIO state machines that are going to matter most - and they run specialized I/O programs. And yes, the 4 state machines in each PIO block can be executing different specialized programs in parallel at the same time.

 

"Multi-threading" is a mechanism within a single program for running two or more things at the same time, which can be used to exploit processors with multiple cores (although multi-threading was invented as a general idea that can actually run perfectly well on a single processor/single core system). So, for example, you could have a program with one thread dedicated to handling the user interface (screen output, user input) and another thread dealing with I/O involving your train layout. Most modern programming languages have facilities for handling multi-threading in one form or another, but the asynchronous nature of such programs can be a challenge to get right...

 

I hope that this helps...

 

Yours,  Mike.

  • Informative/Useful 1
Link to post
Share on other sites

  • RMweb Premium

OK

Help needed

Pico arrived today, duly connected to PC as USB storage, pasted python package to it and it re-booted. - (as described)

 

In Getting Started With Pico page 35: Accessing the Pico from a Win 10 PC.

5 large programs required for Window use, download, install & set up. (what a fag)

One of said programs is "Git" and it says use Notepad++ from the options during it's setup.

Selected Notebook ++ in the options.and Git refuses to set up, the next staged is greyed out

 

Anyone any suggestions?

Link to post
Share on other sites

  • RMweb Gold

Hi,

 

I found this Video very useful...

 

 

It does some simple stuff but it does confirm that everything is working.

He's added some links (open the tab below his you tube video) and I only had to download one simple coms program "CoolTerm" - so far.

 

 

Kev.

 

  • Thanks 1
Link to post
Share on other sites

11 hours ago, melmerby said:

One of said programs is "Git"

Welcome to the wonderful world of Software Developers :rolleyes:

 

Git is a software version control system which handles updates to software under development. It is probably the most commonly used tool for this capability amongst software developers. It is open source software.

 

I'll try and provide you with assistance on this, but a problem that I have is that I don't have a Windows machine - I have Mac and Linux (Raspberry Pi) - so I may have trouble reproducing the situation that you have. 

 

Yours,  Mike.

  • Informative/Useful 1
Link to post
Share on other sites

OK, so after doing a little bit of reading:

 

- Notepad++ is simply a Windows text editor tool, that in this context is intended to be used for editing source code files and such like.

- This is in preference to the default Unix/Linux Vim editor (which in my opinion is very much an acquired taste, like Marmite :O)

 

From what I have read, IF you want to select Notepad++ as the default text editor during Git install, THEN you have to have Notepad++ installed FIRST - and the Pico docs don't tell you this.

 

Notepad++ can be downloaded and installed from here:

 

https://notepad-plus-plus.org/downloads/

 

and the overall process of installing Notepad++ and then installing Git to use it is described here:

 

https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-set-Notepad-as-the-default-Git-editor-for-commits-instead-of-Vim

 

You will note that the dialog that lets you choose Notepad++ as editor also presents you with a list of other editors as options - if you prefer one of those and have it installed, by all means select it from that list. 

 

Of course, us Windows and Mac users are the poor relations here - there is a throw-away comment on p33 of that getting started document which says it all:

 

"the main supported platform for developing for the RP2040 is the Raspberry Pi"

 

and since the folks making the Pico also make the Pi, I can hardly blame them.

 

You will note that all the preceeding chapters of the document, starting on page 5, are about installing and running the SDK on the Pi. They even supply a script to automate all the installation and configuration work on the Pi (also on page 5). So, when I turn my attention to the Pico sometime in the future, I suspect I shall do all the work on my Pi 400 system, which I acquired mainly to run JMRI and automate my layout. Now I can see that it is likely to have other uses as well.

 

We need to remember that the Pi 4 & Pi 400 are really fully-blown computers that can be used for serious software development - a very different situation from the original Raspberry Pi.

 

Yours, Mike

  • Like 1
  • Agree 1
  • Informative/Useful 1
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...