From 2c1bba5a518a0907fe7d23f00501284d4e1bb356 Mon Sep 17 00:00:00 2001 From: Joe Foley Date: Tue, 30 Jun 2026 18:00:28 +0000 Subject: [PATCH 1/4] discussion on the IMU --- imu.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 imu.md diff --git a/imu.md b/imu.md new file mode 100644 index 0000000..74efd54 --- /dev/null +++ b/imu.md @@ -0,0 +1,13 @@ +# The Intertial Measurement Unit + +As of 2025, we started using an AliExpress version of https://wolles-elektronikkiste.de/en/icm-20948-9-axis-sensor-part-i + +This has an unmarked jumper on the back. Joe believes that it shorts the VDDIO and VDD pins in order to allow it to be used with 1.8V devices. + +Marcel has tested that the pads connect to both of those pins. + +The IMU runs on 1.8V, but our Pi has GPIO voltages of 3.3V. Marcel reports that students in 2025 had no problem using it as long as AD0 and NCS were connected to VDD. +According to the specification, the maximum pin voltage is VDDIO+0.5, which would put it at 2.3, a whole volt below 3.3. On his board, he connected the pins to 3.3V though a 10K resistor to protect it from overcurrent. + +For I2C at least, it appears that we are saved by the fact that it is open-drain. Each device communicates to the master by pulling lines low, which should work with both voltages. + From 3358169ad86e4e496721f602f78a57cc2661b1cb Mon Sep 17 00:00:00 2001 From: Joe Foley Date: Sat, 4 Jul 2026 18:41:02 +0000 Subject: [PATCH 2/4] Started documenting setting up PWM --- pwm.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 pwm.md diff --git a/pwm.md b/pwm.md new file mode 100644 index 0000000..243b593 --- /dev/null +++ b/pwm.md @@ -0,0 +1,53 @@ +# Getting the PWM working + +The Raspberry Pi zero (1 and 2) have 2 PWM peripherals, allowing you to pulse pins without the CPU doing any additional work. This is particuarly useful for controlling motor speeds when connected to a motor driver/H-bridge chip. + + +# References +- [Raspberry Pi Official Overlays information (github)](https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README) + - Line 4235 starts the description of the "pwm" overlay configuration +- [Adafruit 2-channel PWM instructions](https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio) + +# Discussion + +My raspberry pi zero W 2 wasn't working reliably with the PWM. + +The `gpio` command has been depricated and is now replaced by the `pinctrl` commend. Running it did not list any PWM0 on any of the pins, which was concerning. + +[This forum post](https://forums.raspberrypi.com/viewtopic.php?t=388352) indicated the need for a `pwm-2chan` device tree overlay to get it to show up. After adding `dtoverlay=pwm-2chan` to the `config.txt`: + +``` +$ pinctrl + 0: ip -- | hi // ID_SDA/GPIO0 = input + 1: ip -- | hi // ID_SCL/GPIO1 = input + 2: a0 -- | hi // GPIO2 = SDA1 + 3: a0 -- | hi // GPIO3 = SCL1 + 4: op -- -- | hi // GPIO4 = output + 5: ip -- | hi // GPIO5 = input + 6: ip -- | hi // GPIO6 = input + 7: op -- -- | hi // GPIO7 = output + 8: op -- -- | hi // GPIO8 = output + 9: a0 -- | lo // GPIO9 = SPI0_MISO +10: a0 -- | lo // GPIO10 = SPI0_MOSI +11: a0 -- | lo // GPIO11 = SPI0_SCLK +12: ip -- | lo // GPIO12 = input +13: ip -- | lo // GPIO13 = input +14: ip -- | lo // GPIO14 = input +15: ip -- | hi // GPIO15 = input +16: ip -- | lo // GPIO16 = input +17: ip -- | lo // GPIO17 = input +18: a5 -- | lo // GPIO18 = PWM0 +19: a5 -- | lo // GPIO19 = PWM1 +``` + +Which looks much better. +There is a pwm chip `in /sys/class/pwm` + +After running the `lgpio/pwm-test.py` +the pin is back to being listed as an input, so I'm confused. +The PWM pin (under load) did the right values. Without a load on the Analog Discovery 2, I just saw noise. + +I commented out `dtoverlay=pwm-2chan` and `lgpio/pwm-test.py` worked. +The pwm chip is missing from `/sys/class/pwm` so I'm guess that's not needed. + + From 18d01e181fe7218689a1237f41dd2e005dca7624 Mon Sep 17 00:00:00 2001 From: Joe Foley Date: Sat, 4 Jul 2026 18:43:08 +0000 Subject: [PATCH 3/4] put proper Adafruit title --- pwm.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pwm.md b/pwm.md index 243b593..55bce23 100644 --- a/pwm.md +++ b/pwm.md @@ -6,7 +6,10 @@ The Raspberry Pi zero (1 and 2) have 2 PWM peripherals, allowing you to pulse pi # References - [Raspberry Pi Official Overlays information (github)](https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README) - Line 4235 starts the description of the "pwm" overlay configuration -- [Adafruit 2-channel PWM instructions](https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio) +- [Adding Basic Audio Ouput to Raspberry Pi Zero](https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio) + +# Important Points +1. The `gpio` program is no longer available. It has been replaced with `pinctrl` which works a little differently. # Discussion From 6009a5eff88c676d74632fa8b9351b9a78a01f0a Mon Sep 17 00:00:00 2001 From: Joe Foley Date: Sat, 4 Jul 2026 18:45:10 +0000 Subject: [PATCH 4/4] procedure reminds people to put the SD card in --- imager.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/imager.md b/imager.md index 7d02e84..a3f4827 100644 --- a/imager.md +++ b/imager.md @@ -44,6 +44,8 @@ We don't have many monitors and keyboards in V207 for students to use, so we wil ![imager-writeimage-verifying.png](Graphics/imager-writeimage-verifying.png) 1. The process is complete! ![imager-complete.png](Graphics/imager-complete.png) +1. Take the SD card and put it into your pi. +1. When you first boot it, it can take 10 minutes to finish configuring itself. Usually when the LED stops blinking for at least 30 seconds, it is done. ## Connecting using Raspberry Pi Connect 1. Login to https://connect.raspberrypi.com if you haven't already