While i run the tensorflow object detection python3 code on my raspberrypi 3B then after 1mits the pi reboots without showing any videos.
https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/blob/master/Object_detection_picamera.py
Alright guys after the help of one of the stackoverflow mate i was able to fix it.
What happened was My power supply only provided 1amp and 5v, but to run my code it required more amps, about 1.8 so when i connect 2amp 5v power supply it worked finally 👍
Related
I'm trying to run a python script automatically when the raspberry pi 4 turns on, and I'm using crontab to do it. The script is a GUI that helps fill and search a database. the raspberry pi doesnt give any errors or exceptions, it just turns on normally and gives no signal of running the script.
the command I used in crontab is:
#reboot python3 /home/pi/Desktop/folder/gui.py &
the libraries that the script uses are:
tkinter
subprocess
pyserial
csv
thank you for your time, this is my first time working in the raspberry pi or a linux environment so I dont understand many things about it.
On the Raspberry Pi, the service that your program needs to use may not be activated. In your example, the Display service may not be activated.
Try to do the following:
#reboot sleep 60 && python3 /home/pi/Desktop/folder/gui.py &
Wait 60s (or more) after the Raspberry Pi starts, which may prevent the code from failing and help solve your problem.
I recently purchased the I2s microphone from adafruit and wired it to my raspberry Pi 3 Model A+. I want to use the module as the microphone but use the on board audio jack for the speaker.
Initially this worked with the terminal when recording with arecord and playing with aplay. When trying to use Python PyAudio it gave me many alsa errors and Jack errors such as:
jack server is not running or cannot be started
PyAudio:
import pyaudio
P = PyAudio()
I traced the error to be called in the initialization of PyAudio at the
pa.initialize()
The code did not break but didn't function how I wanted it to. I am hoping to use the speech recognition library but when I run it once again I get all these errors and then it just listens forever. When I used a timeout it would just give an error saying time out.
Would really appreciate any help, I have been stuck on this all week. I've looked across lots of simular issues and have not found a solution.
So, I want to be able to write Python code in my Visual Studio Code on my Windows PC. On my network is a raspberry pi 4, which I would like to execute said code on and receive any errors or output from.
Is it possible for me to write some python code on my Windows PC, "run" it on the Raspberry pi, and receive any outputs of the program on my Windows PC?
The reason I wish to do this is that Visual Studio Code generally helps me write any code, and it is more time consuming for me to use other IDE's, and my code uses PyBluez, something I can't just test on my Windows PC (which has no Bluetooth module)
I hope my question is in the right format and such! This is my first time posting! Any comments appreciated!
Yes you can do that, but it might not be very straight forward. In order to achieve this, you need your Raspberry Pi to be on the same network as your Windows PC (i.e. on the same WiFi network or connected via Ethernet). Then you need to get the IP address of your Raspberry Pi through the following command:-
ifconfig -a
The IP address will be of the following format: W.X.Y.Z
Now from your Windows PC, you can send your python script/scripts through the following command from cmd:-
scp script.py pi#W.X.Y.Z:/home/
And then you can access your Raspberry Pi and run the program by sshing into it through the following commands from cmd:-
ssh pi#W.X.Y.Z
You'll need to enter the Raspberry Pi's password for both commands above, but after that you should have your script on your Pi and you should be able to run it there from your Windows PC.
The links below have more verbose explanation:-
https://www.raspberrypi.org/documentation/remote-access/ip-address.md
https://www.raspberrypi.org/documentation/remote-access/ssh/scp.md
https://www.raspberrypi.org/documentation/remote-access/ssh/
I hope this helps.
It seems that my answer was to use the Remote Development pack on Visual Studio Code (it's an extension) to ssh into my raspberry pi. It's worked well for me for the past few days, and I highly recommend it. It allowed me to access the entire sd card and access any files I need to, while also giving me an SSH terminal and run the program ON the other machine.
For anyone who does this; set up the whole ssh key thing, to stop having to give the password to the pi so often.
The scp command would also work, I think, but is more complex than what I want to do.
Thank you so much for the answer, JL Peyret!
issue: unable to flash micropython to esp 32: open serial error, please try again. hope to connect internet and try again.
pretty new to micropython - want to flash micropython to esp 32 ( resp 8266) board.
cf this docs: https://maker.pro/esp8266/tutorial/using-micropython-on-an-esp8266-with-upycraft
getting this errors all the time.
open serial error, please try again.
hope to connect internet and try again.
current version only open py txt json ini file.
hope to connect internet and try again.
hope to connect internet and try again.
i run Win 7
the hardware:
a. Joy-IT-Node MCU ESP8266
.. and besides that i also tried it with the following
b. ESP32-T Development Board CP2102 with Espressif ESP-WROOM-32 IoT WLAN & BLE Modul
yes: i have installed the > CP210x_Universal_Windows_Driver.zip
by the way: i could try to do all that on a linux machine. - on a MX-Linux-Sytem
any idea;
many thanks for any and all help in advance.
As of my opinion, You don't necessarily depend on the uPyCraft IDE. So there are several other ways to develop scripts and uploading them to Your board.
Some days ago I was facing problems with Python on the NodeMcu as well. Since I didn't like the tutorials around the web, I've set up one on GitHub, covering the end-to-end process (required software, drivers, firmware images, developing, flashing, uploading, etc.): python2nodemcu.
It depends on Mac and the NodeMcu board, but some of the topics may apply to other operating systems and boards as well.
And I think it covers the most relevant parts of the whole process, using the easiest tools around the web. Please have a look at it, but all in all it goes like this (short version of the linked documentation above):
Install Python 3
Verify with python --version
Or python3 --version
Install the correct SiLabs driver to enable serial USB-to-UART communication
See here
Find the device file (representing the interface to the physical device)
Try it using ls -la /dev/tty.*
Download the recent MicroPython firmware
You need the right one for Your board
Install the two Python-based libraries EspTool and PySerial
Try to erase the flash of Your device
Run python3 esptool.py --port /dev/tty.{device-file} erase_flash
Try to flash the original image or the MicroPython firmware to the board
Run python3 esptool.py --port /dev/tty.{device-file} write_flash 0x00000 {micropython-image-or-original-firmware}.bin
Try to connect to the board via the REPL prompt
Run screen /dev/tty.{device-file} 115200
You maybe need to try different baud rates (depending on Your driver, cable, etc.)
Connect to the board using Ampy
For example, try to list the files on Your device executing python3 ampy/cli.py --port /dev/tty.{device-file} --baud 115200 ls
Again, try other baud rates
Anyway, I've noticed that You do not necessarily need to push the physical flash button on the device.
this is my first time using Raspberry Pi 3 with Python Tkinter to make a GUI.
I have written my script using Python. My code uses Raspberry Pi 3 GPIO 8 and GPIO 11 as inputs. I have 2 relay connected to the 2 inputs terminal. The relay will act as a switch. My code will count how many times the relay have switched on and display in the GUI.
I have tested it using Raspberry Pi 3 LxTerminal with
sudo python /home/pi/Desktop/test.py
The GUI opens and it works perfectly. Every time the relay switches, the count +1.
Then I decided to make it auto boot every time I reboot my Pi. I uses the following technique.
sudo nano /etc/profile
Then add the following code to the final line and save it.
sudo python /home/pi/Desktop/test.py
I reboot my Raspberry Pi and the GUI boot automatically. But the GUI does not response to the relay switching.
I tried rebooting a few times and it worked after a few reboot. Then I tried to reboot again and the next time it does not work again. This steps keep repeating over and over again. Some times the GUI work, some times it doesn't.
Anyone have come across this sorts of problem? What should I do to make the GUI auto boot to works 100%?
NOTE:
Having 5V 1A phone charger to supply power to Pi. (Tried using 5V 2.1A as well)
Connected a HDMI to VGA converter to connect to a monitor
Does not have keyboard and mouse when the GUI is set to auto boot
I have a tkinter GUI that boots on startup on my Raspberry Pi. I did it by adding it to autostart file.
First, make the script executable. Add
#!/usr/bin/python
as the first line of your python script.
Then use this command to make the file executable
chmod +x /home/pi/Desktop/test.py
Now you should be able to start your program without the "sudo python" prefix. Just typing /home/pi/Desktop/test.py in the terminal should boot your program.
Then open autostart file for editing with
nano /home/pi/.config/lxsession/LXDE-pi/autostart
and add
#/home/pi/Desktop/test.py
BTW: you are using "sudo" way to much. You should use sudo very rarely. If you edit user files with sudo you can screw up your file permissions, which leads to very strange bugs. You should need "sudo" when you are installing something, and that's about it.
First of all a Hardware recommendation: sorry for quoting a german page but as shown here https://www.elektronik-kompendium.de/sites/raspberry-pi/1912111.htm your raspi 3 should have minimun a power supply from 5v and 2A but it would be perfect if it supports up to 3A. But thats just some side info.
For me this question PyQt: How to run GUI on Raspberry Pi desktop startup? helped me solving the GUI autostart problem.