The discussion of the Alien series of films and the props used in them is the aim, but if it's got Big Bugs and Big Guns, then they are welcome too!





Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Linux SDcard setup for Raspberry pi
PostPosted: Sat Sep 23, 2017 8:12 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
Download your image here:
https://www.raspberrypi.org/downloads/
noobs or raspbian will work. If you have a weird network setup or are using WEP like me you will need to download the full image and not the lite image. Also bear in mind the lite image will miss a lot of the simple components you might need on some of your builds.

on mac or PC run the sdcard formatter utility
https://www.sdcard.org/downloads/formatter_4/


open a terminal window
run: diskutil list
note your sdcard partition:
on mine it was /dev/rdisk2

change directory to your folder containing your image file(s) and run:
sudo dd bs=1m if=raspianstretch.img of=/dev/rdisk2
you will get output:
Password:
1768+1 records in
1768+1 records out
1854418944 bytes transferred in 125.531660 secs (14772520 bytes/sec)

Device will then auto mount. Dismount and you are ready to boot your raspberry pi.
Note the raspberry pi WILL NOT BOOT if it DOES NOT SEE a proper boot image.
Here is a quick search result for a page listing compatible cards: http://www.raspberry-pi.co.uk/2012/06/0 ... -sd-cards/

Rule of thumb: if you pay less than 10 for the card it might not work with your pi.
I found this out the hard way when I spent all morning trying to get a few Sdcards off of wish.com to work only to find that there is a firmware compatibility issue with the pis and certain cheap scares something to do with data image leveling and communications issues. Hopes are that this will get fixed soon.

Given the fact many builds are now starting to use these I am not sure if this is sticky worthy or not.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Initial OS setup
PostPosted: Sun Sep 24, 2017 2:07 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
OS setup.


Now since I am using web based security I had to hack my interface file in \etc\network

and change below the line : auto wlan0
allow-hotplug walnut
iface wlan0 net dhcp (it was manual)
# comment out the reference to the wpa supplicant
# replace dhcp with static above if you need an unchanging IP
# these are the options used to statically assign an IP address
# address 10.0.0.41
# netmask 255.255.255.0
# network 10.0.0.0
# broadcast 10.0.0.255
# gateway 10.0.0.1
wireless-essid your-ssid-here
wireless-key your-key-goes-here
wireless-channel 6
# use static ip with ad-hoc networks.
# wireless-mode ad-hoc
# iface default net dhcp

(add as shown if you do not see the lines in your interfaces file, then reboot after other adjustments made.)

since I was using nano invoked with the sudo command as per standard security measures (su - and staying as root is disabled by default)

now update your wpa_supplicant:
at the end hit enter and add:
network={
ssid="yourssidhere"
key_mgmt=NONE
web_key0="yourkeyhere"
}

hit cntrl+x and hit y and then enter.

now once you do all that
run:
sudo /etc/init.d/networking restart
sudo service wpa_supplicant stop
sudo service wpa_supplicant start
sudo ifdown wlan0
sudo ifup wlan0



You should see a stream of dhcp ack and offer messages indicating you are now getting an IP address.

If using ad-hoc networks, add this to /etc/rc.local
before the start scripts:

ifconfig wlan0 up
iwconfig wlan0 essid test

Now that you are on the network.

Update your pi:
run:
sudo apt-get update
wait
sudo apt-get dist-upgrade
sudo rpi-update
wait
y
and enter

Generally speaking update your pie to the latest version there are numerous performance issues and bugs that are rapidly being addressed and fixed and this especially applies with the raspberry pi.

_________________
The impossible takes a while longer and goes over budget too...


Last edited by knoxvilles_joker on Fri Sep 29, 2017 12:18 am, edited 4 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Set your keyboard nationality/localization options
PostPosted: Sun Sep 24, 2017 6:06 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
If you have issues mapping keys correctly. In the states run this:

setxkbmap -layout us

you can access raspberry pi configuration from the X-window session. If you don't have that type: "startx" without quotation marks and hit enter.

From the command line run:
sudo raspi-config

you can set localisation options there or from the GUI windows session.

_________________
The impossible takes a while longer and goes over budget too...


Last edited by knoxvilles_joker on Sun Sep 24, 2017 7:15 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: streaming camera
PostPosted: Sun Sep 24, 2017 6:55 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
sudo apt-get install vlc

streamer with the pi camera:

raspivid -h 600 -w 800 -o - -t 0 | cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264

on client device:
launch vlc
open network
address http://x.x.x.x:8090

on the client pi run:

omxplayer -o hdmi http://x.x.x.x:8090

vlc will not work properly with the pi due to the software decoding quirks and lack of a VPU and use of CPU processing.

Update:
After losing the last card (I will tape it in for transport next time.) I had to rebuild the setup. As I always try to improve things and fix issues I had with the last go around I found these options offered better performance:

raspivid -h 600 -w 800 -o - -g 10 -fps 24 -b 5000000 -t 0 | cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264

-fps is frames per second
-h and -w is the resolution
-b is the bitrate
-g is the refresh rate
-t is the time to save zero is not time limit
-o is the output file name (- equates to nothing)

The key for better performance is to lower resolution, buffer rates, and frame rates. You will still have a few seconds delay due to the way the protocols and hardware works. To put it in perspective the raspberry pi is equivalent to a 486 from 30 years ago from a processor and video stand point.

_________________
The impossible takes a while longer and goes over budget too...


Last edited by knoxvilles_joker on Wed Sep 26, 2018 1:38 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: set script to launch at startup
PostPosted: Sun Sep 24, 2017 8:24 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
I have not had luck with this:
crontab -e
@reboot nohup /boot/camera.sh &

I instead have to do this:
sudo nano /etc/rc.local

before exit 0
add
nohup /boot/camera.sh &

add "sleep 30" or some other number within the camera.sh.
You want to have a login screen so you can kill the script really quick after boot up in case you need to tweak something as there will be no way to exit the camera.sh script otherwise.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Network troubleshooting
PostPosted: Fri Sep 29, 2017 12:30 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
OK first for wireless connections, IWLIST and IWCONFIG are your friends. Second the network setup with jessie and raspbian is a little iffy for the pi zero ws. I have tried to include sufficient information to cover getting it working from the command line.

You can manually set parameters with IWCONFIG that you can later save to /etc/network/interfaces.

for example:

sudo iwconfig wlan0 essid test mode ad-hoc channel 6

sets your interface wlan0 with an said of test in ad-hoc mode on channel 6 (default is channel 1 which tends to be congested.)

sudo ifconfig wlan0 down
sudo ifconfig wlan0 up

shuts down and starts back up interface wlan0.

ifconfig lists all active interfaces. If you do not see wlan0 or eth0 the interface is not online or up.

TO setup ad-hoc mode:

sudo iwconfig wlan0 mode ad-hoc
sudo iwconfig wlan0 esset yourssid

then run
iwconfig wlan0
if it says no cell associated then check your settings on both computers

If using ad-hoc networks, add this to /etc/rc.local
before the start scripts:

ifconfig wlan0 up
iwconfig wlan0 essid test

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Not all distress are the same
PostPosted: Mon Oct 02, 2017 11:38 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
Apparently only NOOBS works OK with the pi zero w.

Jessie Stretch that I spent the past week on will not work properly with the motion tracker setup.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Linux SDcard setup for Raspberry pi
PostPosted: Mon Sep 24, 2018 4:01 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
OK they came out with an updated version earlier this year in June.

On the newer version they changed the folder structures. It does not appear that they have fixed some of the pi zero w issues.

add this to /etc/network/interfaces by invoking this command
sudo nano /etc/network/interfaces

Below the last line add:

iface lo inet loopback
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address x.x.x.x
netmask 255.255.255.0
gateway x.x.x.x
wireless-mode ad-hoc (default is infrastructure)
wireless-essid your-ssid-here
wireless-key your-key-here
wireless-channel 6 (or your set channel if not using FHSS in which case do not add this line)
iface default inet dhcp

For some reason dhcp was being very fussy and after building it this way I had internet connectivity. As I was using WEP for some other technical reasons and I live in the country physical hacking of the network is not a concern as I am so remote. If you are using WPA it might work out of the box without issues.

You will need to not use ad-hoc until you do all OS updates and install vlc player.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Linux SDcard setup for Raspberry pi
PostPosted: Wed Sep 26, 2018 1:44 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
Mod's Once, I get the smart gun and helmet camera working on this, this will be worth archiving, but will need to be periodically updated.

Linux keeps changing.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Linux SDcard setup for Raspberry pi
PostPosted: Sat Oct 06, 2018 2:59 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
OK after much trial and error I found that these settings had to be set.

on the client device displaying the streamed footage add the following to:
/etc/rc.local
ifconfig wlan0 up
iwconfig wlan0 essid test
(these force a driver communication and engage/activate the ad-hoc network setup. You will get no ad-hoc association until you run these commands, took me a week or two to hash that out)

I found that I had to set power settings by doing the following changes
in: /etc/lightdm/lightdm.conf
add: [SeatDefaults]
xserver-command=X -s 0 -dpms
in: ~/.config/lxsession/LXDE-pi/autostart
add:
@xset s 0 0
@xset s nonblank
@xset s no expose
@xset dams 0 0 0
(this is some more power settings)

On the device with the camera invoke the script this way:
in /etc/rc.local
add:
su pi -c 'nohup /boot/player.sh &'
(su pi -c must be used as vlc and cvlc can not be run as root and you will get access errors if you do not invoke the command this way. It took me almost a week to hash that out)

on both (make sure address is different on both but on same network)
in /etc/network/interfaces
add if not there:
auto wlan 0
iface wlan0 net static
address x.x.x.x
network x.x.x.0
netmask 255.255.255.0
gateway x.x.x.x
wireless-mode ad-hoc
wireless-ssid your-ssid
wireless-key your-key
wireless-channel # (1-11 (12 or 13 depending on your country)
iface default inet dhcp
iface lo net loopback
(this manually builds the interface and breaks dhcp incidentally)

in /boot/config.txt
add:
hdmi_blanking=1
(this is a power setting to keep the screen on)

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Linux SDcard setup for Raspberry pi
PostPosted: Sun Jan 20, 2019 4:37 pm 

Service Number: A05/TQ2.0.32141E1
Country: United States
OK, I had a major snafu as I was redoing the setup. I cracked the SD card for the camera. I got that rebuilt. There was a November update for the Raspberry pi operating system for Stretch (code name for the operating system.) There were also updates to VLC, OMXPLAYER as well. Some reading indicating the newer versions had created some stability issues. To resolve I had to change the setup slightly.

First off, I found that after you make the network changes, reboot. But first after booting up I run sudo iwconfig wlan0 essid test on both devices. Then I ping the respective device addresses. If you get response good. The updated operating system update really helped with the network portion, but unless you run a specific version, you will have to build the wireless interface as I am running it.

You can comment out lines with # or pound as it is called so as in my case I cheated and mirrored by wifi setup but set to adhoc. Thinking things through since I am using a statically set channel for stability reasons so I switched to a non conflicting channel. Channel 1 is the default channel for most devices which is why for home I set on channel 6, so in this case I switched to channel 11. If you are in Japan channel 12 and 13 are an option, just do not try to run on those channels here in the states as you can run afoul of some officials if they get really fired up about conflicts and interference.

That did not help with omxplayer crashing out. Now to test the stream for omxplayer on the client you can run:
omxplayer -i http://x.x.x.x:xxxx and it will displayer information on the stream or give you a connection error with which you can troubleshoot further.

I tried implementing RTSP, but for simplicity sake I wanted to avoid complicating the setup in case others, less able, wanted to do the same. You apparently require a different way of launching the camera stream and a few extra program installs.

Now since I updated everything as part of the troubleshooting process:
running:
sudo apt-get update
sudo apt-get upgrade
sudo rpi-update
sudo apt-get omxplayer
sudo apt-get vlc
I partially gave myself a few issues doing this.
I kept getting a 1wire error message on the client pi so I ended turning off all the additional protocols on it which alleviated the issue. (run: sudo raspi-config)

Now to finally get the client to stream without crashing I launched it this way:
omxplayer -o hdmi --live http://x.x.x.x:xxxx
And it seems to be stable now.

I was also now getting a permissions error when trying to invoke launching of the script from /etc/rc.local (a file that launches things on startup that are not services)(crontab is setup for services, but this setup did not require that amount of monkeying to implement as of yet)
So I had to add before exit 0:
su pi -c "nohup /boot/camera.sh &"
Then it launches fine.

The other issue I had was that I had to rotate my screen
To do that I had to edit /boot/config.txt and add the line:
display_hdmi_rotate=2
this flips the display 180 degrees. There are some different ways to do this but they are all screen dependent and some of the command are deprecated or removed/discontinued, but may still work depending on your specific setup.

Now in the camera script I add a delay of 30 seconds by adding the line:
sleep 30
in the player I add a delay of 90 seconds.

I specifically place the scripts in /boot as that folder is visible when you mount the sd card on your computer. This allows you to rename or delete the file if you are unable to kill the process after boot up.
To kill a process you have set to launch in /etc/rc.local run:
sudo killall script.sh
where script.sh is the name of your script. In my case camera.sh and player.sh depending upon the raspberry pi you are running.

To see if the script is running, run the command again and it will say it can not find it or:
run:
ps -aux | grep script.sh
If nothing comes up it is not running you are good, if you see a line you can run:
sudo kill pid
where pid is the process id or process number of the script that is running. killall searches for any related instances of the named process and kills/quits/terminates all of them.

Now the other issue that I had not mentioned is getting your keyboard to work right. With Linux, the bane is getting your specific keyboard to work right. The linux community to a greater extent are computer experts, hackers (ethical and otherwise), security experts. so computer manufacturers have a vested interest in ensuring that a device has drivers for linux as there has been more than one case where a site was brought down for lack of drivers, or the drivers were magically given, or sold to the manufacturer. (One of my former coworkers spent a weekend reverse engineering a device driver and sold a built linux driver to the manufacturer for 40k, so yes ethical hacking does have a positive use.)
All that said, stick to name brand keyboards, and research the Hardware Compatibility List (HCL) for Linux and get a keyboard you will be comfortable using. I have had the occasional cheap junk bite me in this regards.

To set or customize your computer after doing all the updates run:
sudo raspi-config
go to localization
select keyboard, and select your options. Sometimes the close fit is best. Regional language and keyboard layout are what you really need to pay attention to.

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
 Post subject: Re: Linux SDcard setup for Raspberry pi
PostPosted: Wed Feb 06, 2019 3:25 am 

Service Number: A05/TQ2.0.32141E1
Country: United States
OK, finally got the camera client to not quit by adding this to the invocation of omxplayer: --avdict stimeout:60000000,timeout:-1

This adds buffering and a delay to prevent quitting from a poor connection.

So the command on the client will look like this: omxplayer -o hdmi --live --avdict stimeout:60000000,timeout:-1 http://x.x.x.x:xxxx

_________________
The impossible takes a while longer and goes over budget too...


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: