Description

1. Environment & Components

Coding Environment Tested on: ROG Zephyrus M16 Intel Core i7-11800H 16GB RAM Windows 10 21H2 WSL2: Ubuntu 20.04.5 LTS Board: Pico4ML Sensors: build-in LCD (ST7735) build-in camera (hm01b0) LSM6DS33 Gryo IMU and Accel sensor Pico4ML Pico4ML is using RP2040 for the microprocessor, with an LCD screen drived by ST7735. Basically we are refering to the code to drive the camera and LCD display. LSM6DS33 6-DoF Accel + Gyro IMU The sensor is basically dirved by i2c.

2. Developing Overview

To start with, we are planning to implement a simple flappy bird game on the C platform, with one button to manipulate the flying of the bird. To achieve our plan, we first implemented the flappy bird game with microPython on the RP2040 chip. With the external LCD screen, we can successfully play this game with the python code. Then, the next step was to write up drives to transform the code into C and make it able to operate on the PICO4ML broad.

3. Challenge We Ran into

One major problem we met during our development was the fps frequency. In the first attempt that we launch the program, we ran the chip at its normal frequency. However, the calculation speed does not provide optimal performance for the game, it runs pretty slowly and the movement is obviously discrete. Thus, we overclocked the chip to improve its performance. Finally, the fps has been stabled to 15 frames per second, which seems much more smooth for a visual game.

4. Reflection on Our Design

The biggest mistake that we made in our project is that we didn’t realize that the PICO4ML broad has its own IMU sensor embedded on the chip; Thus, it is totally unnecessary for us to implement an external drive for an additional chip.

5. Advantage

The advantage of our project is that we have to implement a control-free strategy, that the player doesn’t need to use any button to play the game; all he or she need to do is to flip over the board, then we can start the game and play! In addition, the game has great completion, which means that the game has its way to attract people to continue playing: who does not want to control his or her cars to rush on a busy street?

6. PIO module

We are basically using pio to drive the i2c, just like what we do in Lab2b. This is a more reliable and faster way to estabilish communication between sensors and MCU. We modified the code in Lab 2b, by configuring the registers within the IMU chips, we successfully received the serial data in the test program on QT2040 broad; then we transplanted the function onto our PICO4ML broad. When we fully grasp how i2c works, we can use pio to simulate an identical i2c function.

7. Future Improvements

As a final project embryo, there is a lot we could improve to make the game more playable. For example, as we mentioned in the challenges sections, we can use external resources and pictures to replace the code-generated shape, to make the game more pretty. Also, we could implement more functions to the game. As an embedded program, we need also replace the communication protocol between LCD and the chip. Currently we are using GPIO to drive the spi protocol, which seems not fast enough and requires more operational effort; later we can also switch it to PIO ports, which could be faster and this would be beneficial for the performance of the program.

1. Environment & Components

Coding Environment

Tested on: 
	ROG Zephyrus M16
	Intel Core i7-11800H
	16GB RAM
	Windows 10 21H2
	WSL2: Ubuntu 20.04.5 LTS
Board:
    Pico4ML
Sensors:
	build-in LCD (ST7735)
    build-in camera (hm01b0)
    LSM6DS33 Gryo IMU and Accel sensor

Pico4ML

pico4ml

Pico4ML is using RP2040 for the microprocessor, with an LCD screen drived by ST7735.

Basically we are refering to the code to drive the camera and LCD display.

LSM6DS33 6-DoF Accel + Gyro IMU

lsm6ds33

The sensor is basically dirved by i2c.

Assembly Details

We soldered our IMU on top of our PICO 4ML broad. Please note that since the direction of our soldering does not align with the direction of the preset XYZ of the sensor, in the game code, we manually modified the sensing direction by 90 degrees to fit the direction.

overview

cable

Block Diagram

blockdiagram

We are basically using Pico4ML control every thing. We are using i2c to drive the camera and gryo imu, spi to drive the LCD.

The project code is here, based on Pico-sdk. The specific code structure is detaily discribed in the repositories.