A Cyron Maker Nano RP2040 based UKMARSBOT running python

This is a UKMARSBOT chassis and sensor board but using a Pi Pico microprocessor on a Cytron Maker Nano RP2040. This means that if you want to use a Raspberry Pi chip based device and program in python you can do this with this setup. The chassis and sensor boards use the UKMARSBOT robot ones that are described more at this link: UKMARSBOT

Here is a picture of the Cytron Maker Nano RP2040 installed on a UKMARSBOT chassis

To install micro-python on the Cytron CPU board go to this link Pico getting started and follow the instructions to download the UF2 file onto your pico. The best way of using the pico in python is with Thonny application (Available for free at https://thonny.org/) You need to use the latest version - at least version 3.3.3 for pico support. Note that if you already have Thonny installed on your development machine it may install in another place and not update any shortcuts you have. On my Windows 10 PC I had to set up a new shortcut to the new location. You also need to go into Thonny Tools then Options then the interpreter tab then select MicroPython (Raspberry Pi Pico) and then with the pico plugged into a USB socket, select the Port

You should now be able to write micro python programs in Thonny, and when you choose "save as" it willl give you the option to save it either on your development machine or onto the pico.

You can use the stop and run buttons in thonny to run the program on the pico RP2040 chip, and if you include print statements for diagnostic purposes these will print on your development machine in the console section of Thonny below the code

If you save your program as main.py on the RP2040 chip it will automatically run when you power up the pico without the USB connected.

So what is different with micro python? First point to note is that when you set up an input or output pin using a micro-python statement such led = Pin(25, Pin.OUT) the PIN number used refers to the GP number not the physical pin number Here is a link to a text file that contains a simple line following program which demonstrates the use of pin assignments, analogue input and PWM output Python line follower code

Now in terms of using the pico on the UKMARSBOT chassis there are a few things to do : Firstly, we need to provide a 3.3V power source for the RP2040 chip on the Cytron board. On this UKMARSBOT we use a 9v battery for power and let the Cytron Maker Nano RP2040 generate the 3.3V line that we use.

Secondly, remember that the RP2040 chip only accepts 3.3v inputs not 5 volts, so we disable the 5V output from the board by disconnecting the 5V output from the Cytron board. The easiest way to do this is to simply remove that part of the socket that woudld normally take the 5V frpm the CPU board to the UKMARSBOT main board PCB. We then connect together the 5v and 3.3v power lines on the board on the last 2 pins of sensor connetor J1. The board and all the components on it will work just fine at 3.3 volts. The LEDs will not be quite as bright, but still plenty bright enough for line following. For wall following you might want to reduce the LED series resistors to about half their normal value.