FreshRSS

Zobrazení pro čtení

Jsou dostupné nové články, klikněte pro obnovení stránky.

Pi5 Cyberdeck in a vintage enclosure from 1953

Pi5 Cyberdeck in a vintage enclosure from 1953

https://preview.redd.it/vwh7016x0vgd1.jpg?width=4032&format=pjpg&auto=webp&s=88f869bc63931cda58c827567424cea9726e389a

This is my first cyberdeck build. The enclosure is a 26 x 12 x 7 cm new old stock enclosure. The panels that hold the keyboard and monitor are made from FR4 PCBs. Inside, there is a Pi 5 with an active cooler. I also added a Pimorini NVMe base and a 500Gb SSD. I also added a 30mm fan for the enclosure itself. The display is a standard 7" USB powered HDMI display.

I also made a short video of the build.

submitted by /u/hansj66 to r/RASPBERRY_PI_PROJECTS
[link] [comments]

How can I use Ubuntu encrypted using LUCKS on my RPI5?

Hello,

I want to use Ubuntu Desktop or Server (doesn't really matter which one) on my Raspberry Pi 5 using my NVME 1TB SSD. I have no SD-Card so the way im installing Ubuntu on my RPI is that I plug the USB Stick into my normal Windows PC, then using RPI Imager flash Raspbian (Raspberry PI OS) onto the USB Stick, then plug the stick into RPI and boot up, on the RPI OS go to /boot/firmware/config.txt then add dtparam stuff to enable pci, next open Imager and install Ubuntu os on the ssd. Then just unplug the usb and reboot, done.

But now I want to add full disk encryption to to that Ubuntu system on the ssd, how can I achieve this?

submitted by /u/temal32 to r/RASPBERRY_PI_PROJECTS
[link] [comments]

HyperHDR project Help Needed!!

HyperHDR project Help Needed!!

Hello! I am working on adding an Ambilight system to a TV using a Raspberry Pi 3 B+. I started this project last week, but the RPi 4 I was using at the time got fried due to overvoltage (as some commenters on r/WLED warned me of). Lesson learned, and I pivoted from using a now extra crispy RPi 4 to the Pi 3 B+ you see in the picture. I have some problems with the final pieces of this project, and I was hoping reddit could come to my rescue again. (I will give a detailed description of the setup at the end of the post)

I cannot get the lights to do anything when connected to the Pi. I know the lights work, as I have tested both the lights and the harness using a separate Bluetooth controller made by the same company as the light strip. I do not have the backup wire (blue) connected, as it was not necessary to run the lights with the Bluetooth controller. The DAT wire (green) is connected to the GPIO18 pinout on the Pi, and I am confident the crimped connectors used are not the problem. I have also added a common ground between the lights and the Pi (white). Basically, I have narrowed it down to either a software issue (No doubt my fault) or an issue between the pinout and the connector. I am already out of my depth regarding this project and am hesitant to continue trying things on a whim (See burnt RPi 4). I will happily share screenshots of my HyperHDR settings if needed.

For my set-up, I have a Raspberry Pi 3 model B+, powered by a 5V 3A PSU coming from the top of the picture, and plugged into the USB Micro adaptor on the Pi (HyperHDR warns me the Pi isn’t being supplied with enough voltage, but I do not have another solution for power on hand. Suggestions are welcome). The Pi is running HyperHDR 20.0.0.0 and does not seem to have any issues doing so. Entering the Pi from the left side of the screen is the HDMI cable, which then runs into and HDMI to USB type-A Video Capture, which is then connected to the Pi. On the right side of the screen is a 12V 15A power supply wired to the harness connected directly to the lights. The white cable running directly from the lights to the Pi is the common ground connected to a ground pinout on the Pi. The green wire leading from the harness to the Pi is the DAT wire connected to the GPIO18 pinout. The blue wire is the backup wire. This backup wire does not need to be connected to the first-party controller for the LED strip to work, so I assume it does not need to be connected to the Pi. I have run several tests with this backup wire and the DAT wire connected to the GPIO18 pinout using a 1 to 2 terminal block, but nothing has changed.

As I said, I am way out of my comfort zone with this project, and as such I am open to any and all constructive feedback and will be as responsive as possible. I appreciate any help you can provide. If and when I finish this project, I will be sure to post the results!

https://preview.redd.it/24kql0jlpqgd1.jpg?width=2901&format=pjpg&auto=webp&s=582904b120746fd0243b0bd606b5f5dedb9230fa

submitted by /u/GameKnight9000 to r/RASPBERRY_PI_PROJECTS
[link] [comments]

RaspPI 3.5 display not working

Hello there, I recently bought a RasPI 3.5-inch TTF touch module and am facing issues using it. The module, even after all drivers are installed, does not display any output. The guild on the website also does not go into detail on how to troubleshoot it and I was not able to find any useful info on debugging this issue.

I will list out everything I have done until now: - Reinstalled Raspbian Desktop image. - Configured the Xserver to work (even though the driver install script does it). - Tried to manually display an Image (this is interesting and I will further explain this below). - Used Python to try and display an image.

So at first, I thought while installing it, I followed the standard procedure and it did not display anything other than a black screen with an _ in it. next, I tried to delete everything and then reinstalled it, but still no luck. Next, I removed the image and used a fresh image, no use. then I tried using this command: ``` sudo fbi -T 1 -d /dev/fb1 -noverbose -a /home/pi/test_image.png

``` to forcefully display something and when I did this a terminal interface got printed but was not usable, then I figured the framerate was flicked so, I tried changing the refresh rate that also did not work.

Now I am lost on what to do. Any suggestions will be appreciated.

I am using a rasp pi zero 2 w for this.

submitted by /u/Ok_Quail_385 to r/RASPBERRY_PI_PROJECTS
[link] [comments]

PWM mosfet output does not correspond to pwm input

PWM mosfet output does not correspond to pwm input

My goal is to use the PWM signal of a raspberry pi to control the speed of a 12V 0,24A DC fan.

The drawing below shows how I've wired everything up.

https://preview.redd.it/q3hajn2igegd1.png?width=696&format=png&auto=webp&s=b7f9c7a46d9a186b513c4aae2346e2c07711fb6d

I purchased a cheap mosfet module off of aliexpress:

https://de.aliexpress.com/item/1005005625110568.html

Amazon carries them too:

https://www.amazon.de/gp/product/B07HBQZ9BK

The module uses a FR120N mosfet.

Link to datasheet: https://pdf1.alldatasheet.com/datasheet-pdf/view/1223399/VBSEMI/FR120N.html

I use the pigpio python library to control the duty cycle of the pwm signal at 20kHz. When using a multimeter the readings (RPi PWM - RPi GND) perfectly correspond to the duty cycle I set in the code.

The problem: The voltage readings across the fan do not match the duty cycle at all.

At 50% duty cycle I would expect 6V but I get almost the max voltage already. (See table below)

https://preview.redd.it/gkeewuljgegd1.png?width=193&format=png&auto=webp&s=e0943f62f52e10331250e1eb1cc709ac4650a733

In summary I am able to control the duty cycle of the PWM signal but the output of my mosfet module is not what I expected.

The subjective fan speed matches the measurements of VFan (meaning there is no observable change between a duty cycle of 50-100%)

I understand that a minimum average voltage to turn on the fan is needed but why does the fan get about 6 V at 20% duty cycle and not at 50%?

Why is there minimal voltage change across the fan from 50% to 100% duty cycle?

Why does the voltage across the fan not correspond to the duty cycle?

I guess it has sth to do with the mosfet module but I am unable to pinpoint the issue.

submitted by /u/JoeKongdeezNuts to r/RASPBERRY_PI_PROJECTS
[link] [comments]

2.8inch DPI LCD and WM8960 Audio HAT together, possible?

Hi,

for a project I bought a 2.8inch DPI LCD and WM8960 Audio HAT both from Waveshare. Since the audio hat has GPIO extension I thought it would it be possible to stack one on top of the other. THe idea is to give "comact" audio and video output to a Raspberry Pi Zero, as much pankake as possible with no wires going around. For speaker I'm using 2w 28 mm speakers, no need for hd audio.

Well, I followed the intsructuon to edit the config.txt and add the overlays for the LCD and all went ok, once I understood that the drivers works only with Legacy 32 full image. Then I installed the audio drivers and the display stopped working. I uninstalled the audio drivers and checked the config.txt file were clean and the display worked again.

Is there a way to make this happen? Can you suggest another compact way of bringing audio out for the rpi? Maybe by using a usb board, taking data and power from the testing pads?

submitted by /u/the_jeby to r/RASPBERRY_PI_PROJECTS
[link] [comments]

Troubleshooting IR Sensor Project: Seeking Guidance

Hi everyone,

I’m working on my first Raspberry Pi project and could use some guidance. I’m building a theremin-like digital instrument using two SHARP GP2Y0A51SK0F IR sensors. Each sensor is supposed to trigger one of five audio clips based on distance.

Here’s what I’ve done so far:

  • I’ve set distance thresholds for each audio clip (e.g., 14-15cm triggers Clip 1, 11-13cm triggers Clip 2, etc.).
  • I’ve written code to handle sensor input and play the clips accordingly.

However, I’m encountering a few issues:

  • Erratic Playback: The audio clips play erratically and seem to be cut off at the low and high ends of the distance range.
  • Persistent Playback: When no object is in front of the sensors, one clip plays continuously until something comes into range.

I’m wondering if:

  • There might be improvements or adjustments I can make in the code to address these issues.
  • The IR sensors might not be ideal for this application, and if alternatives like ultrasonic or Time-of-Flight sensors could be better (ideally want to solve with coding before buying new hardware)

Here’s my code for reference:

import RPi.GPIO as GPIO import time import spidev from subprocess import call import threading import statistics # Setup SPI spi = spidev.SpiDev() spi.open(0, 0) spi.max_speed_hz = 1350000 # MCP3008 channel configuration sensor1_channel = 0 sensor2_channel = 1 # Distance to audio mapping with updated intervals distance_ranges = [(14, 15), (11, 13), (8, 10), (5, 7), (2, 4)] audio_files_sensor1 = [f"/home/jss/audio_clips/s1_clip{i+1}.m4a" for i in range(len(distance_ranges))] audio_files_sensor2 = [f"/home/jss/audio_clips/s2_clip{i+1}.m4a" for i in range(len(distance_ranges))] # Smoothing parameters smoothing_window_size = 5 sensor1_data = [] sensor2_data = [] def read_adc(channel): adc = spi.xfer2([1, (8 + channel) << 4, 0]) data = ((adc[1] & 3) << 8) + adc[2] return data def get_distance(sensor_channel, sensor_data): adc_value = read_adc(sensor_channel) distance = (adc_value * 3.3 / 1024) * 30 # Smoothing the distance using a simple moving average sensor_data.append(distance) if len(sensor_data) > smoothing_window_size: sensor_data.pop(0) smoothed_distance = statistics.mean(sensor_data) print(f"Smoothed distance from sensor {sensor_channel}: {smoothed_distance}") # Debugging return smoothed_distance def play_audio(file): try: print(f"Playing audio file: {file}") # Debugging call(["mpv", file]) except Exception as e: print(f"Error playing audio file: {file}. Error: {e}") def handle_sensor(sensor_channel, audio_files, sensor_data): last_played_index = -1 while True: distance = get_distance(sensor_channel, sensor_data) for i, (low, high) in enumerate(distance_ranges): if low <= distance <= high: if i != last_played_index: play_audio(audio_files[i]) last_played_index = i break time.sleep(0.1) def main(): print("Script started...") # Debugging # Create and start threads for each sensor sensor1_thread = threading.Thread(target=handle_sensor, args=(sensor1_channel, audio_files_sensor1, sensor1_data)) sensor2_thread = threading.Thread(target=handle_sensor, args=(sensor2_channel, audio_files_sensor2, sensor2_data)) sensor1_thread.start() sensor2_thread.start() # Wait for both threads to finish (they won't in this case) sensor1_thread.join() sensor2_thread.join() if __name__ == "__main__": main()import RPi.GPIO as GPIO import time import spidev from subprocess import call import threading import statistics # Setup SPI spi = spidev.SpiDev() spi.open(0, 0) spi.max_speed_hz = 1350000 # MCP3008 channel configuration sensor1_channel = 0 sensor2_channel = 1 # Distance to audio mapping with updated intervals distance_ranges = [(14, 15), (11, 13), (8, 10), (5, 7), (2, 4)] audio_files_sensor1 = [f"/home/jss/audio_clips/s1_clip{i+1}.m4a" for i in range(len(distance_ranges))] audio_files_sensor2 = [f"/home/jss/audio_clips/s2_clip{i+1}.m4a" for i in range(len(distance_ranges))] # Smoothing parameters smoothing_window_size = 5 sensor1_data = [] sensor2_data = [] def read_adc(channel): adc = spi.xfer2([1, (8 + channel) << 4, 0]) data = ((adc[1] & 3) << 8) + adc[2] return data def get_distance(sensor_channel, sensor_data): adc_value = read_adc(sensor_channel) distance = (adc_value * 3.3 / 1024) * 30 # Smoothing the distance using a simple moving average sensor_data.append(distance) if len(sensor_data) > smoothing_window_size: sensor_data.pop(0) smoothed_distance = statistics.mean(sensor_data) print(f"Smoothed distance from sensor {sensor_channel}: {smoothed_distance}") # Debugging return smoothed_distance def play_audio(file): try: print(f"Playing audio file: {file}") # Debugging call(["mpv", file]) except Exception as e: print(f"Error playing audio file: {file}. Error: {e}") def handle_sensor(sensor_channel, audio_files, sensor_data): last_played_index = -1 while True: distance = get_distance(sensor_channel, sensor_data) for i, (low, high) in enumerate(distance_ranges): if low <= distance <= high: if i != last_played_index: play_audio(audio_files[i]) last_played_index = i break time.sleep(0.1) def main(): print("Script started...") # Debugging # Create and start threads for each sensor sensor1_thread = threading.Thread(target=handle_sensor, args=(sensor1_channel, audio_files_sensor1, sensor1_data)) sensor2_thread = threading.Thread(target=handle_sensor, args=(sensor2_channel, audio_files_sensor2, sensor2_data)) sensor1_thread.start() sensor2_thread.start() # Wait for both threads to finish (they won't in this case) sensor1_thread.join() sensor2_thread.join() if __name__ == "__main__": main() 
submitted by /u/sawyer000000 to r/RASPBERRY_PI_PROJECTS
[link] [comments]

Spotify telegram bot running on pi 0 2w

Spotify telegram bot running on pi 0 2w

So i got sick of the spotify shuffle bcoz it was not playing the old songs in my playlist. So i made python telegram bot to shuffle the playlist and also it can update a playlist with the songs from shazam and liked songs. It basically collects the uri id of songs from liked,main playlist and shazam and builds a database. From that can easily add or rearrange songs in the playlist. Now I'm really up for saving money for a decent pi 4/5 in future😙. https://github.com/jidukrishna/spotify_updater

submitted by /u/jiduk to r/RASPBERRY_PI_PROJECTS
[link] [comments]

BB1-zero update. Arms fine tuning and wire cleanups

BB1-zero update. Arms fine tuning and wire cleanups

Finally been cleaning up the wires and doing some fine tuning on smoothing out the arms. Unfortunately I’m pretty sure he pulled out one of the grounds (my fault ) at the end of this dance. It started doing that pulsing thing it does when a ground is lose. So another takedown and redo is in order. 🤦‍♂️😂. Still pretty happy with it tho.

submitted by /u/TheRealFanger to r/RASPBERRY_PI_PROJECTS
[link] [comments]

How to properly connect a bidirectional data line to Raspberry Pi 5 GPIO? [Project details & documentation inside]

How to properly connect a bidirectional data line to Raspberry Pi 5 GPIO? [Project details & documentation inside]

I am new to the Pi community and my head is spinning from learning all about GPIO pins, voltages, and communication protocols. Though it has been fun learning all these new concepts.

I am struggling to properly connect a bidirectional data wire from an external machine [coin hopper] to my Raspberry Pi 5. When I use my Pi to send a request to the hopper, I get no response. I'm not sure if I am setting up this data wire correctly, so I would love insights from the community.

High-level Project Details and Objective

  • My project is an automated coin identifier & sorter. I am using a Raspberry Pi 5

https://preview.redd.it/haj0u0tc6cfd1.png?width=720&format=png&auto=webp&s=32dbe2ed85517b33461accfd85448970b0f9e0d8

  • Here is a video of the most recent project prototype [coin hopper has not been added to the system yet]
  • Have the Pi be able to transmit data to & receive data from a coin hopper
  • I am using Python
  • The coin hopper uses the ccTalk & UART serial interface protocol
  • Avoid frying my coin hopper and Pi
  • I am using a 16-gauge solid core copper wire [insulated] for the power supply and data wire

Details

I am trying to connect a Coin Hopper [Money Controls SCH 2 model] to my Pi 5. The SCH2 uses a 10-pin Moxel connection scheme and uses a bi-directional serial data line.

SCH2 Coin Hopper

10-pin Molex Serial Connector

Pin Configurations

SCH2 Online Manual/Documentation

SCH2 uses the serial interface ccTalk & UART protocol**. ccTalk** is a very old protocol which makes sense as the coin hopper was produced in 2005.

From Manual

From ccTalk Wikipedia page: https://en.wikipedia.org/wiki/CcTalk

The coin hopper is powered by a 24v power supply. Below is what the power supply looks like

Power Supply from Amazon: https://www.amazon.com/dp/B07VL8W6MQ

I am using a female terminal connector adapter to connect the 24v wire and ground wire from the coin hopper directly to the power supply. [Pins 4 & 6 on the hopper]

https://preview.redd.it/izfz20md3cfd1.jpg?width=4372&format=pjpg&auto=webp&s=687b11ebcf7062054fd895d12df19754a5cdc2fa

https://preview.redd.it/1k3y8y0e3cfd1.jpg?width=3046&format=pjpg&auto=webp&s=2eb38827f83b1dac8fa4daa5cddf2508fa943ee4

I read that since the coin hopper uses 24v, it could damage the Pi 5 as the Pi operates at 3.3v logic level. Even though the only connection from the coin hopper to the Pi is with the bi-directional data line. As such, I am using a 3.3V/5V to 3.6V/24V 4 Channel Voltage Converter Optocoupler board. The board is NOT bi-directional.

Voltage Converter from Amazon: https://www.amazon.com/dp/B07WFGTNQC

To better communicate with the Pi's GPIO, I am using this GPIO expansion board

GPIO Extenstion board from Amazon: https://www.amazon.com/dp/B08GKQMC72

This GPIO expansion board has a TXD and RXD port.

My current understanding

  • Pi5 GPIO structure does not allow for bi-directional data communication. As such I need to use my GPIO extension board which has a TXD [Transmit] and RXD [Receive] port. I can not connect the coin hopper's bi-directional data wire solely to the TXD or RXD port and expect bi-directional communication
  • Since the coin hopper operates at 24v, I assume it uses 24v logic level. As such, a voltage converter is needed. Though, I am unsure why as I would think a data wire is not powering anything, just sending data and thus very low voltage.
  • The ground wire from the coin hopper [Pin 6] should connect to the ground socket on the power supply female terminal.

Outstanding Questions

  • What do I need to consider to connect the coin hopper's bi-directional data wire to the Pi? Am I missing a key part/board?
  • Do I need to use the UART serial protocol? Is there a better alternative that will still work with the coin hopper?
  • Do I need a GPIO extension board? If so, is my current extension board appropriate?
  • Do I need a voltage converter board? If so, is my current converter board appropriate? Do I need to get a bi-directional converter board? [My current one is not bi-directional]
  • Should the ground wire from the coin hopper [Pin 6] connect to the ground socket on the power supply? Or should the ground wire from the coin hopper [Pin 6] connect to the ground socket on the GPIO extension board on the Pi?
  • Does it matter if my wires are solid or stranded copper?

This has been a confusing journey but I'm excited to get the coin hopper up and running. The idea is to automate my coin sorter so that I don't have to place a coin manually each time. The Pi will communicate with the hopper to queue up the next coin after a coin has gone through the sorter.

Edit: Clarification on what I have already done and tested

I have already attached the GPIO extension board and voltage convertor to the Pi

https://preview.redd.it/3u7k8y2k6efd1.png?width=683&format=png&auto=webp&s=ea358c61f93acddc69b68d87ebc58500697ff65d

https://preview.redd.it/fdisgigl6efd1.png?width=696&format=png&auto=webp&s=a9c7b61604c49e8ad1bb1fa509d80a99762537f1

On the voltage convertor there, on the left side in the picture, are ports indicating Input & Ground. On the right side is Voltage Output and Ground. I connected a 22-gauge wire from IN1 [Input 1] to the GPIO extension board [TXD]. I also connected the wire from the input ground port to the ground port on the GPIO extension board [next to the TXD port.

https://preview.redd.it/dy69vjm97efd1.png?width=553&format=png&auto=webp&s=bb9449eba777f728aecaba64adcf4a36a7fba5ff

https://preview.redd.it/2rz3oeb87efd1.png?width=562&format=png&auto=webp&s=25535bcc934c1d3d1997ea7dcf63a04a594c91c7

For the connection with the coin hopper, I connected the data cable wire from the hopper to V1 and a ground wire from the hopper in G.

https://preview.redd.it/xufskpgl7efd1.png?width=567&format=png&auto=webp&s=4f3ec1c81607a318c7a90118811a757ca8461233

I am trying to send a command from the Pi through to the GPIO extension board. That data then goes through the extension board to the data cable wire to the coin hopper.

However, the coin hopper does not send a response back confirming communication.

Below is what I have done to troubleshoot:

  • Testing Communication Protocols:
    • Verified ccTalk protocol uses UART for serial communication.
    • Ensured the correct baud rate (9600 8N1) for ccTalk messages.
    • Enabled the Pi serial port and confirmed the correct serial is online and avaliable
  • Software and Library Installations:
    • Installed and configured pyserial for serial communication.
submitted by /u/SomeGuyInDeutschland to r/RASPBERRY_PI_PROJECTS
[link] [comments]

Raspberry Pi 5 NAS using Argon Neo 5 NVME case

Hello all! I'm new to the Raspberry Pi scene; however, I have recently found my interest piqued by the tinkering possibilities of the Raspberry Pi. I am currently in the process of creating a NAS server that will be primarily used to maintain a photo library to offload from my phones. I am looking for suggestions, feedback, and any remarks on my build. The build will be as follows: - Raspberry Pi 5 - Argon Neo case with NVME support - 64GB Micro SD to download Pi OS Lite and Open Media Vault - 1 TB Crucial NVME

Additionally, I am also planning on buying a Black Shark phone cooler that I will stick above the Argon Neo's aluminum case with the theory that it will cool the metal down, which will cool the air within the case down, and therefore the fan's in the case will be circulating cold air to the Raspberry Pi.

I understand some of you might be asking me why I am not running RAID and multiple bays. Well, I don't want to increase the budget of this build anymore. It was supposed to be USD 250, and I'm already at USD 260.

submitted by /u/xVeranex to r/RASPBERRY_PI_PROJECTS
[link] [comments]

Need help picking parts for an autonomous car (Raspberry Pi 5)

Hi, Recently I bought a Raspberry Pi 5 so that I can use it in a project of mine, an autonomous car.

Unfortunately I'm not very experienced with electronics and I need help because I see that everybody online chooses different parts.

I want the car to be powered by a single LiPo battery with 11.1V and 2200mAh (with the XT60 plug). I want it to power the Raspberry Pi 5, a small 130 motor (3V) and a servomotor.

My question is, how do I power all of them from the same battery? I've searched and found that I can use a motor driver, I've seen more complex builds that use some additional parts. I'm just really unsure on how to connect all these so that they are powered by the Raspberry Pi only. I doubt the motor driver can power all 3 of them so I'm searching for either something else or something additional.

If anyone has some recommendations, articles that I can read, videos or anything to point me in the right direction, please send 'em my way.

submitted by /u/Popular-Remove-3536 to r/RASPBERRY_PI_PROJECTS
[link] [comments]

Mounting an NVMe on a Raspi 5 with Ubuntu server

Heyo everyone,

So this is quite frustrating..

I got myself a raspberry pi 5... A rasperry pi 5 pcie M.2 hat ( The pimoroni Duo )

The idea is to use proxmox on the PI. Just for fun.

My current problem is that the ubuntu server can't see nor mount the nvme.. And whenever I search for help I get loooots of sites helping me on how to boot from an nvme.. I do not want to boot from my nvmes.. I want the os to run from the SD card and then mount the nvmes into the os...

Does anyone here have any ideas how to accomplish that?

Thanks for reading.

P.S. I'm slightly triggered that there's no one just mounting an nvme.

submitted by /u/stoffel2107 to r/RASPBERRY_PI_PROJECTS
[link] [comments]

RuntimeError On My Raspberry Pi Code

I am using a very basic test code provided at the end of this video linked below (I'm basically trying to rebuild her robot with a few extra mods but I haven't even added the mods yet)

https://www.youtube.com/watch?v=Bp9r9TGpWOk

I keep getting this error:

RuntimeError: The GPIO channel has not been set up as an OUTPUT

It marks the error at the first line of my forward function.

I have tried googling the solution and this is the only link that comes close to solving my issue but not quite as I'm not using GPIO.cleanup(), so I have no idea what else my issue can be. I've reviewed the code a dozen times, and it should be working, as I'm essentially doing this but with some extra steps:

import time

import RPi.GPIO as GPIO

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BOARD)

GPIO.setup[29, GPIO.OUT]

GPIO.setup[31, GPIO.OUT]

#30 GND

GPIO.setup[32, GPIO.OUT]

GPIO.setup[33, GPIO.OUT]

GPIO.output(29, True)

time.sleep(3)

GPIO.output(29, False)

GPIO.output(31, True)

time.sleep(3)

GPIO.output(31, False)

GPIO.output(32, True)

time.sleep(3)

GPIO.output(32, False)

GPIO.output(33, True)

time.sleep(3)

GPIO.output(33, False)

time.sleep(3)

exit()

And this code worked perfectly fine. I don't know why it shit the bed as soon as I brought classes into the equation. The pins all work, and they all respond to the pi calling them out exactly like this. I think it must be something in my syntax that's making it freak out and throw this error. I removed all the extraneous stuff I added in for my future mods (except for some of the imports), and nothing fixed it. I'm putting my code below.

#GPIO Settings

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BOARD)

#labeling pins

GPIO.setup[29, GPIO.OUT]

GPIO.setup[31, GPIO.OUT]

#30 GND

GPIO.setup[32, GPIO.OUT]

GPIO.setup[33, GPIO.OUT]

class Robot:

def __init__(self, name, rwheel, lwheel):

self.name = name

self.rwheel = tuple(rwheel)

self.lwheel = tuple(lwheel)

self.rwheel_f = int(rwheel[0])

self.rwheel_b = int(rwheel[1])

self.lwheel_f = int(lwheel[0])

self.lwheel_b = int(lwheel[1])

def forward(self, sec):

GPIO.output(self.rwheel_f, True)

GPIO.output(self.lwheel_f, True)

#stop

time.sleep(sec)

GPIO.output(self.rwheel_f, False)

GPIO.output(self.lwheel_f, False)

def backward(self, sec):

GPIO.output(self.rwheel_b, True)

GPIO.output(self.lwheel_b, True)

#stop

time.sleep(sec)

GPIO.output(self.rwheel_b, False)

GPIO.output(self.lwheel_b, False)

def lturn(self, sec):

GPIO.output(self.rwheel_f, True)

#stop

time.sleep(sec)

GPIO.output(self.rwheel_f, False)

def rturn(self, sec):

GPIO.output(self.lwheel_f, True)

#stop

time.sleep(sec)

GPIO.output(self.lwheel_f, False)

#establishing ob

smelly = Robot("smelly", (29, 31), (32,33))

#test run

smelly.forward(3)

smelly.backward(3)

smelly.lturn(3)

smelly.rturn(3)

Again, I'm following her code exactly, so I'm not sure where I could have gone wrong on this. Again, I get the error attached to the first line of my forward function.

submitted by /u/ameerkatofficial to r/RASPBERRY_PI_PROJECTS
[link] [comments]
❌