Quantcast
Channel: Recent Questions - Raspberry Pi Stack Exchange
Viewing all 49714 articles
Browse latest View live

minicom cannot write to UART on certain laptop, works on different one

$
0
0

I have connected UART according to https://learn.sparkfun.com/tutorials/headless-raspberry-pi-setup/serial-terminal and set enable_uart=1 and dtoverlay=miniuart-bt in config.txt.

Running the system, reading the output works correctly, but I cannot write to UART. This happens only with minicom, using latest version 2.7.1 from Debian package:

minicom -D /dev/ttyUSB0 -C /home/foo/minicom.log -b 115200 -c on

Writing works on other laptop (openSUSE, also using the latest version from package, using the same command line options). And what is strange, if I try other software (e.g. socat, screen) on Debian (machine, where minicom fails) writing also works. What can be wrong?


Having trouble setting an outbound connection for PiVPN

$
0
0

I have been following the PiVPN setup from comparitech and I've been stuck at the step "Using IPVanish as an outbound VPN"

I've configured both the server.conf and the outgoing.conf in every way I could imagine but I still cannot the outbound connection and change my location.

I can however use the OpenVPN gui and create a profile that way and connect to the Pi, but my location remains the same.

Instead of IPVanish, I'm using Windscribe, I've downloaded the .ovpn, .crt and .ket files, along with the credentials I need to use them. I put all of this into the etc/openvpn/ folder.

I think there is some issues with my server.conf and outgoing.conf (formerly the windscribe.ovpn file) files. Help would greatly be appreciated as I have been stuck on this for 2 days.

Edit: from server.conf, I changed google's DNS to windscribe's

push "dhcp-option DNS 10.255.255.3"

push "dhcp-option DNS 10.255.255.2"

from the outgoing.conf, I added these lines

"#" Exception to the LAN

route 192.168.0.100 255.255.255.0 192.168.0.199

Monitoring hardware accelerated video decoding

$
0
0

I'm using RPi4 board with Raspbian on top of it

I wonder if there is a way to tell if any process currently using hardware accelerated video playback?

Ideally it would be nice to be able to say which process exactly is using it, but it's not critical.

I know there could be various interfaces and probably it's possible to detect V4L2 M2M usage with /dev/video10 device opened. But what's about MMAL interface? If it makes difference I'm interested in playback of H.264 videos.

I've considered following approaches but haven't found any traces:

  1. Using lsof to track specific dev-files
  2. Checking state of kernel using sys-files
  3. Using vcdbg or vcgencmd to get stats

python code runs fine outside, does nothing on Raspberry Pi

$
0
0

As the title suggests, I have a code that runs perfectly on my laptop. It connects to my solar inverter, grabs the information, and writes(appends) them to a CSV file.

When I run the same code through ssh on raspberry Pi, it runs without the error most of the time, however, it does not write(append) to the CSV file.

the code is as follow:

import jsonimport urllib.requestimport csv# api callpath = 'MY IP/solar_api/v1/GetInverterRealtimeData.cgi?Scope=Device&DeviceID=1&DataCollection=CommonInverterData'# Initialising the values, if there is an error, these would be reported.PAC = 'Nan'  #Eenrgy generated @ this moment with urllib.request.urlopen(path) as url:    data = json.loads(url.read().decode()) # reading json filejson_keys = [x for x in data.keys()] head = data[json_keys[1]]      # getting the content of the headtimestamp = head['Timestamp']  # Reading Timedate = timestamp[:timestamp.index('T')]                        #the datetime = timestamp[timestamp.index('T')+1: timestamp.index('+')] #the hourbody = data[json_keys[0]] # Body has only 'Data' in itbody = body['Data']       # Getting the content of the Data in the BodyPAC = body['PAC']['Value']  #Eenrgy generated @ this moment otpt_lst = [time, PAC]with open(str(date)+'.csv', 'a', newline='') as csvfile:    slr_wrtr = csv.writer(csvfile, delimiter=',')    slr_wrtr.writerow(otpt_lst)

Both are running in Python3, the python3 in my machine is more recent, in RBpi it is 3.5.8, and on my machine, it is 3.7.4. The way I set it up is, I am using RBpi to be SMB. I use my laptop to access the folder in External HDD attached to rbpi.

When I run the code on the attached HDD in my machine, I never ran into problems. when I do so on the RBPI, sometimes I get issues, not being able to read timestamp, etc, which are strange but fine for now.

Regardless, the main issue is when rbpi finishes executing the code, if it is successful, it does not write to the CSV file.

I have checked my permissions on the folder, and I have drwx access.I have tried to write instead of append, changed the filename, etc.

A sample of the JSON file I am reading from is http://www.filedropper.com/getinverterrealtimedatacgi

Appreciate it if someone can point me in the right direction on how to troubleshoot this, please.

Stream all system audio to Raspberry Pi from elementryos

$
0
0

I have this setup

enter image description here

The old HP server I'm using as a desktop, but it doesn't have audio hardware at all - nothing in the bios, nothing on the motherboard. I want all audio from any application to go out the audio jack on my raspberry pi, which is hooked to an amplifier.

That's all. I don't want a music server, or playlists, or to stream audio from my phone or run a dnla server or anything. Just an "external sound card".

I've read many descriptions of mpd and pulseaudio and mopidy and who knows what else. They talk about editing config files which don't exist, perhaps because they aren't written with raspbian 10 in mind?

what is the simplest way to achieve this setup?

Switching regulator component on Raspberry Pi 4 fallen off

$
0
0

I lost the component lables KE 8J617 on my Raspberry 4

Do you know where I can get that component or what the name of that is (did a google search on the KE 8J617, that showed nothing)

Component

Cheers!

Raspberry Pi locks Me Out After Setup

$
0
0

I've looked around, but I haven't seen anyone with a similar problem. So, I just installed a fresh copy of rasbian on an SD card, but after setting up the password and configurations, I'd next try to see if I can access the pi via serial connection. However, when prompted to login, I provide the correct username and password, and I cannot log in. However, if I access the desktop of the pi through it's video ports, I'm able to log in and switch between users without any problems. Anyone know why this is and how I can get my serial connections working?

Raspberry pi 3B+Serial communication is enabled in configurations

Pi running android OS, is it possible to control GPIO actions?

$
0
0

I feel like I have an interesting question (but maybe not). Obviously the Pi has the GPIO pins that can control servos and sensors. Is it possible to control these with the RPi version of android installed?

Backstory: I'm building a unity game which can only run on the Pi if the Pi is running android. Unity does not support ARM processors unless it's through an apk, which is an android installation file. So I want to get this unity game on my pi and when certain scenes are triggered, I'd like the pi to trigger some GPIO actions like turning on a small fan to simulate wind in the scene or turning on a strip of LED's when the player enters a certain room, etc.

I'm assuming that I need to run python scripts to access the GPIO functionality, which is the "normal" way to do it.

1)Is it possible to call python scripts within the Android OS environment on the Pi?

2)Is it possible to access the GPIO's through C# which is what Unity scripts are written in?

3)Is there a game engine that supports VR that can output games compatible with the Pi's ARM system running an OS other than android (raspbian for example)?

Or does anyone know of an alternative route to achieve this? The end goal is running a Unity (or possible alternative game engine) game on the pi that can interact with the GPIO's to trigger actions in the real world through peripherals attached to the player's station.


Segmentation faults on every GPIO STR

$
0
0

I am stuck and hoping for a clue. These lines seem to show the issue. It is for a Pi4.

.equ IOBASE, 0x7E200000

.equ GPFSEL2, 0x08 //offset to reg for IO Pins 20 - 29

.align 4

LDR R0, =IOBASE

//skip read modify write for now, just set the bits

LDR R1, =0x08

STR R1, [R0, #GPFSEL2] //Make Pin 21 output

It all assembles, compiles without warning or error, but I get a seg. fault at every STR operation when running. Makes no difference if I log in as pi or su. Using a high level language and/or a package like pigpio would defeat the purpose.

Any ideas?

Issues installing and running pivpn (loop because it doesn't like my kernel?) wireguard

$
0
0

I have a raspberry pi 4b with 32gb sd card and attached to a SSD (usb3 port). Berryboot loads raspbain on ssd to run. This works fine

I tried simply just running curl -L https://install.pivpn.io | bashIt wants me to update my kernel before wireguard will even install I think. It is a loop asking me to reboot and update a kernel that is already the lastest even when it says it's not.I literally don't know what is going wrong.

I figure this is because the newest kernel for raspbian OS doesn't work for wireguard or that it won't work on a raspbian desktop... but it said it could on the pivpn webpage.

Is it possible to detect input voltage using only software?

$
0
0

I'm a newbie to Raspberry Pi's, but one of the things I was thinking about doing is running it off batteries (I see many people do this) - that led me to concerns about shutting down gracefully. Is there a software only solution that would allow me to detect input voltage?

Wifi Configuration wlan0 unassociated

$
0
0

Using: Model B Version 2

Dongle: TP-Link model TL-WN823N

os: raspbian

Tutorial: http://www.circuitbasics.com/raspberry-pi-wifi-installing-wifi-dongle/

Following the tutorial above i have altered the files:

/etc/network/interfaces

/etc/wpa_supplicant/wpa_supplicant.conf

Despite hours of my best(though limited in ability) efforts, i cannot get the pi connected to the internet through the wifi.

I assume that dongle works, and is compatible with my pi as i can use the command to return a list of wireless networks:

sudo iwlist wlan0 scan

the two files have been altered to show:

#/etc/network/interfaces    auto loiface lo inet loopbackiface eth0 inet dhcpauto wlan0iface wlan0 inet dhcpwpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

and

#/etc/wpa_supplicant/wpa_supplicant.confctrl_interface=/var/run/wpa_supplicantctrl_interface_group=0update_config=1network={    ssid="YOUR WIFI NETWORK NAME"    psk="YOUR WIFI PASSWORD"}

i simplified the later after seeing it was possible on websites offering similar tutorials. When i type iwconfig i get:

wlan0 unassociated nickname:"WIFI@Realtec"

Any help with this situation would be appreciated.

In my rage i have also managed to hide the network icon on the GUI, bonus points for how to turn that back on...

EDIT: I've now come code which works, but i'm unsure of why the initial bit did not, will be happy to accept an answer which can tell me this. I've also added the code i'm now using below to help anyone like myself who could end up here from google.

BLE + RPi 3 + Node.Js

$
0
0

I am currently developing an application where I connect from an Android/iOS app to the Raspberry Pi 3 via Bluetooth/BLE. Once paired, the RPi will send temperature measurements to the mobile app.

I searched the internet, and honestly I found many articles and forum topics where they address these issues, but I wasn't fully satisfied with what I found (no step by step guide for newbies).

Skills missing to accomplish this:

  • Creating a node js server that sends data through RPi BLE/Bluetooth
  • Creating a mobile app that connects to RPi and gets the data.

I know there are million ways to do it, but I need the best and quickest solution. I already know how to develop Android Apps, but also I prefer using something like Cordova/PhoneGap (Fast and multi-platform)

Can you please suggest any guides for me to ramp up quickly?

Missing dpkg after sudo apt-get update

$
0
0

I've tried to update my raspberry, received 503 Service Unavailable message and now I can't install anything, because of missing dpkg directory..

root@raspberrypi:/sys/bus/w1/devices# sudo apt-get update

Ign ://archive.raspberrypi.org jessie InReleaseIgn ://archive.raspberrypi.org jessie Release.gpg
Ign ://archive.raspberrypi.org jessie Release
Err ://archive.raspberrypi.org jessie/main armhf Packages
503 Service Unavailable [IP: 93.93.128.133 80]Err tp://archive.raspberrypi.org jessie/ui armhf Packages
503 Service Unavailable [IP: 93.93.128.133 80]Ign ://archive.raspberrypi.org jessie/main Translation-en
Ign ://archive.raspberrypi.org jessie/ui Translation-en
Get:1 ://mirrordirector.raspbian.org jessie InRelease [14.9 kB]Get:2 ://mirrordirector.raspbian.org jessie/main armhf Packages [8981 kB]Get:3 ://mirrordirector.raspbian.org jessie/contrib armhf Packages [37.5 kB]
Get:4 ://mirrordirector.raspbian.org jessie/non-free armhf Packages [70.3 kB]
Get:5 ://mirrordirector.raspbian.org jessie/rpi armhf Packages [1356 B]
Ign ://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign ://mirrordirector.raspbian.org jessie/main Translation-en
Ign ://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign ://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 9105 kB in 1min 32s (98.7 kB/s)
W: Failed to fetch ://archive.raspberrypi.org/debian/dists/jessie/main/binary-armhf/Packages 503 Service Unavailable [IP: 93.93.128.133 80]

W: Failed to fetch ://archive.raspberrypi.org/debian/dists/jessie/ui/binary-armhf/Packages 503 Service Unavailable [IP: 93.93.128.133 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory)E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Now when I try update again:

root@raspberrypi:/tmp# sudo apt-get update

Hit ://archive.raspberrypi.org jessie InRelease
Hit ://mirrordirector.raspbian.org jessie InRelease
Hit ://archive.raspberrypi.org jessie/main armhf PackagesHit ://mirrordirector.raspbian.org jessie/main armhf PackagesHit ://archive.raspberrypi.org jessie/ui armhf Packages
Hit ://mirrordirector.raspbian.org jessie/contrib armhf PackagesHit ://mirrordirector.raspbian.org jessie/non-free armhf PackagesHit ://mirrordirector.raspbian.org jessie/rpi armhf Packages
Ign ://archive.raspberrypi.org jessie/main Translation-en
Ign ://archive.raspberrypi.org jessie/ui Translation-en
Ign ://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign ://mirrordirector.raspbian.org jessie/main Translation-en
Ign ://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign ://mirrordirector.raspbian.org jessie/rpi Translation-en
E: Could not open lock file /var/lib/dpkg/lock - open (2: No such file or directory)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Now i can't install anything...

root@raspberrypi:/tmp# apt-get download dpkg

E: Could not open file /var/lib/dpkg/status - open (2: No such file or directory)E: The package lists or status file could not be parsed or opened.

My lib directory:

root@raspberrypi:/tmp# ls /var/lib/

PackageKit dhcpcd5 logrotate openbox polkit-1 samba systemd udisks2 usbutils xkbapt ieee-data nfs pam python sgml-base ucf update-rc.d vim xml-corecontainer lightdm ntp plymouth python-support sudo udisks urandom xfonts

Can you guys please help? My connection is working fine..

Setting up an ad-hoc network with Raspbian Jessie

$
0
0

There's plenty out there on setting up an ad-hoc network on your RPi, (Mine's an A, I believe.) but almost none on how to do it when you're using Raspbian Jessie. As such, I'm having a bit of trouble getting things working.

I've altered my /etc/network/interfaces to read

auto loiface lo inet loopbackiface eth0 inet dhcpauto wlan0iface wlan0 inet manual    wireless-channel 1    wireless-essid PiNet    wireless-mode ad-hoc#allow-hotplug wlan0#iface wlan0 inet manual#    wpa-conf /etc/wpa_supplicant/wpa_supplicant.confallow-hotplug wlan1iface wlan1 inet manual    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

To get a static IP, I altered my /etc/dhcpcd.conf by adding

interface wlan0static ip_address=192.168.1.1/24

to the bottom of the file.

I also installed isc-dhcp-server and changed my /etc/default/isc-dhcp-server by adding wlan0 to INTERFACES=''

Finally, I changed my /etc/dhcp/dhcpd.conf by...

  • changing ddns-update-style none; to ddns-update-style interim;
  • uncommenting authoritative;
  • and adding subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.5 192.168.1.100 } to the bottom of the file.

It creates an open network PiNet, but my computer can't connect to it.

Is there anything obvious that I've missed?


Getting Sound with Qemu and Raspbian

$
0
0

I successfully set up a current Raspbian (Jessy) with Qemu. But I really need a soundcard. I'm not sure, if the Sound Chip of the Pi is supported by Qemu?

To boot I use the Kernel from https://github.com/dhruvvyas90/qemu-rpi-kernel

I start the emulation with:

qemu-system-arm -kernel kernel-qemu-4.4.34-jessie -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda raspbian.img -net nic -net user,hostfwd=tcp::2222-:22 -soundhw es1370

I also tried different QEMU_AUDIO_DRV (Win: dsound, Linux: pa, oss, alsa). But after all there is no sound card available.

Use MCP23017 pin for read data

$
0
0

I just get an MCP23017 circuit and wired it to my raspberry pi like in datasheet. I am able to set pins for hight/low (tested with leds) using this code:

import wiringpi as wiringpifrom time import sleeppin_base = 65       # lowest available starting number is 65i2c_addr = 0x20     # A0, A1, A2 pins all wired to GNDwiringpi.wiringPiSetup()                    # initialise wiringpiwiringpi.mcp23017Setup(pin_base,i2c_addr)   # set up the pins and i2c addresswiringpi.pinMode(65, 1)         # sets GPA0 to outputwiringpi.pinMode(66, 1)         # sets GPA1 to outputwiringpi.pinMode(67, 1)         # sets GPA2 to outputwiringpi.pinMode(68, 1)         # sets GPA3 to outputwiringpi.pinMode(69, 1)         # sets GPA4 to outputwiringpi.digitalWrite(65, 1)sleep(0.5)wiringpi.digitalWrite(66, 1)wiringpi.digitalWrite(65, 0)sleep(0.5)wiringpi.digitalWrite(67, 1)wiringpi.digitalWrite(66, 0)sleep(0.5)wiringpi.digitalWrite(68, 1)wiringpi.digitalWrite(67, 0)sleep(0.5)wiringpi.digitalWrite(69, 1)wiringpi.digitalWrite(68, 0)sleep(0.5)wiringpi.digitalWrite(69, 0)

My question is how can i use these pins for connect a hx711 module to it. If i use hx711 directly to raspberry pi i am using this code:

 s = HX711.sensor(pi, DATA=27, CLOCK=22, mode=CH_B_GAIN_32, callback=cbf)

So i don t know what to put instead 27 and 22 in my code to use GPA0 and GPA1 as data pins for hx711

Thank you

PiTFT Touchscreen calibration is ignored by Pi Zero W

$
0
0

I'm using an Adafruit 2.4" Resistive PiTFT on my shiny new Raspberry Pi Zero W and I've finally managed to get the display configured but the touchscreen is proving a problem... (Please note that instead of setting X11's framebuffer to /dev/fb1 to get X11 to show up on the touchscreen, resulting in a tiny desktop, I'm using fbcp from boot to copy the entire display there so I get all fullscreen programs to work, etc.).

When I use ts_calibrate and ts_test, the touchscreen calibrates and works fine, but when I use xinput_calibrator for trying to make the touchscreen work with X11, it makes no difference. I've tried copying the output into /etc/X11/xorg.conf.d/99-calibration.conf (as is required) and then rebooting, but that doesn't make any difference either! Not only that, I can change the SwapXY value and the InvertX and InvertY values between 0 and 1 all I want and it doesn't change the mapping of the touchscreen! All the settings are simply being ignored by the OS and I have no idea why.

Connect TFT Display with jumper instead of ribbon cable?

$
0
0

I wanted to rebuild this RPi Zero Project: https://learn.adafruit.com/pigrrl-zero/overview

But instead of paying 50(!) Dollars for a 2.8 Inch TFT i wanted to get some other lcd... I do still need some spare GPIOS for the custom controls (12 GPIOS to be exact). The LCD Display that i wanted to use plugs in with a 2x 20 pin, but doesnt use all GPIOS:

Interface Define:

24--GPIO7 --------> TP_CS

26--GPIO8 --------> LCD_CS

22--GPIO25 --------> TP_irq

23--GPIO11 --------> SPI_CLK

21--GPIO9 ---------> SPI_MISO

19--GPIO10 ---------> SPI_MOSI

5v ---------> 5v

GND ---------> GND

Does this mean that when i define the GPIO Button controls in the Retrogame config and only use GPIOS that are "green" (3.3v) and not used by the LCD, I can just solder jumpers to all the GPIOs That the LCD would need and plug them into the LCD, while using the rest for the controls?

Pinout of my Zero

The Numbers That are written as "GPIO[x]" are the ones sued by the software and listed for the LCD

Use USB microphone as input, but keep internal sound card as output

$
0
0

I want to record void with an USB microphone on a Raspberry PI running Raspbian (Jessie). At the same time, I want to keep the audio output on the internal sound card. Similar questions on this site do not include a useful answer.

Card indices:

pi@raspberrypi:~ $ cat /proc/asound/modules  0 snd_bcm2835 1 snd_usb_audio

alsa.conf:

pi@raspberrypi:~ $ cat /usr/share/alsa/alsa.conf | grep '.card 'defaults.ctl.card 0defaults.pcm.card 0

~/.asoundrc:

pi@raspberrypi:~ $ cat ~/.asoundrcpcm.!default {    type hw    card 0}ctl.!default {    type hw    card 0}

Now when I set the cards in both configuration files to 1, I can record audio with the command arecord temp.wav --format=S16_LE. However, I can’t play it, since the microphone card that’s currently configured has no output.

How do I configure the system in a way, that only the input is taken from the microphone card with index 1?

I tried setting ctl.card to 1 while leaving pcm.card as 0 and also changed the card values in .asoundrc accordingly. Recording audio looks on card 0 still.

Viewing all 49714 articles
Browse latest View live