Raspberry pi
config.txt
reference: http://rpf.io/configtxt
on my device I did this:
config.txt
dtparam=i2c1=on dtparam=i2c_arm=on dtparam=i2s=on dtparam=spi=on dtoverlay=dwc2 enable_uart=1 start_x=0 gpu_mem=16
some versions:
Pre 20200425
dtparam=i2c_arm=on dtparam=i2s=on dtparam=spi=on dtparam=audio=on dtdebug=1 dtoverlay=dwc2
cmdline.txt
one line:
console=serial0,115200 console=tty1 root=PARTUUID=738a4d67-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh
reformat for readability
console=serial0,115200 console=tty1 root=PARTUUID=738a4d67-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh
for network over usb to host add:
modules-load=dwc2,g_ether
like this:
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_ether
crypto for pi?
googled "cryto offload for raspberry pi" feb 4th 2016:
https://jbdatko.files.wordpress.com/2014/07/cryptomakers_nopause.pdf
https://news.ycombinator.com/item?id=9436284
... jwr 285 days ago I think you are entirely missing the point of these Atmel chips. More generally (and this is not necessarily addressed to you specifically), I find the knee-jerk response of "just use a Raspberry Pi" amusing. I design embedded systems. Raspberry Pi is, at a first approximation, completely useless, for any task you might want to throw at it. There are many reasons. Power consumption, complexity, failure rate, poor reliability, reliance on SD cards, poor SD card reliability, poor peripherals, poor documentation, I could go on. RPI has two things going for it: 1) the video processing peripherals, 2) publicity/popularity. Now, when thinking about embedded systems, most of the time I won't even consider things the size of a Pi (or the much, much better BeagleBone Black). They are monsters, enormously complex and power-hungry beasts. What I will consider are MSP430s, STM32s, Kinetis K and L, and similar — so ARM Cortex M0, M0+ and M4 cores, running at about 50MHz, consuming around 60mW of power (about as much as an LED), and taking up about, say, 8mm2 of board space (that includes all necessary passives). These are well documented, have reasonable complexity, and can be programmed carefully to achieve excellent reliability. These systems also need crypto, and by crypto I don't just mean "accelerated AES". The Atmel security line is not just "accelerators". In other words, this board is a very interesting prototyping tool, and no, the answer to any problem is not "just use a Raspberry Pi".
Mounting the sd card
under windows host virtual box
.\VBoxManage.exe internalcommands createrawvmdk -filename "C:\data\VirtualBox VMs\head 100\sdc.vmdk" -rawdisk \\.\PhysicalDrive2
links
- https://github.com/notro/rpi-firmware/wiki/BCM2708vsBCM2835 ( zero is a BCM2835 but the rasbian i build against 2708 )
serial
source: http://elinux.org/RPi_Serial_Connection
- Speed (baud rate): 115200
- Bits: 8
- Parity: None
- Stop Bits: 1
- Flow Control: None
Be sure to connect TX RX and Ground
Took me some time to get this to work.
1. when i had the ground not connected I got spurious characters in the boot process.
2. when I didn't have flow control none I could see the boot process clean but could not type anything.
Networking
/etc/network/interfaces
config goes in here
IPV6
turn it on or off here: /etc/modprobe.d/ipv6.conf
blacklist ipv6
ssh over usb
https://www.thepolyglotdeveloper.com/2016/06/connect-raspberry-pi-zero-usb-cable-ssh/
config.txt append:
dtoverlay=dwc2
cmdline.txt add:
modules-load=dwc2,g_ether
GPIO
pi@raspberrypi:~ $ sudo apt-get install wiringpi Reading package lists... Done Building dependency tree Reading state information... Done wiringpi is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded. pi@raspberrypi:~ $ gpio -v gpio version: 2.32 Copyright (c) 2012-2015 Gordon Henderson This is free software with ABSOLUTELY NO WARRANTY. For details type: gpio -warranty Raspberry Pi Details: Type: Pi Zero, Revision: 03, Memory: 512MB, Maker: Sony * Device tree is enabled. * This Raspberry Pi supports user-level GPIO access. -> See the man-page for more details -> ie. export WIRINGPI_GPIOMEM=1 pi@raspberrypi:~ $ gpio readall +-----+-----+---------+------+---+-Pi Zero--+---+------+---------+-----+-----+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | | | 3.3v | | | 1 || 2 | | | 5v | | | | 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5V | | | | 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | | | 4 | 7 | GPIO. 7 | IN | 1 | 7 || 8 | 1 | ALT0 | TxD | 15 | 14 | | | | 0v | | | 9 || 10 | 1 | ALT0 | RxD | 16 | 15 | | 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 | | 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | | | 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 | | | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 | | 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | | | 9 | 13 | MISO | IN | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 | | 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 | | | | 0v | | | 25 || 26 | 1 | IN | CE1 | 11 | 7 | | 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 | | 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | | | 6 | 22 | GPIO.22 | IN | 1 | 31 || 32 | 0 | IN | GPIO.26 | 26 | 12 | | 13 | 23 | GPIO.23 | IN | 0 | 33 || 34 | | | 0v | | | | 19 | 24 | GPIO.24 | IN | 0 | 35 || 36 | 0 | IN | GPIO.27 | 27 | 16 | | 26 | 25 | GPIO.25 | IN | 0 | 37 || 38 | 0 | IN | GPIO.28 | 28 | 20 | | | | 0v | | | 39 || 40 | 0 | IN | GPIO.29 | 29 | 21 | +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+ | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM | +-----+-----+---------+------+---+-Pi Zero--+---+------+---------+-----+-----+ pi@raspberrypi:~ $
I2C
ADS1015
install
https://github.com/adafruit/Adafruit_Python_GPIO
and
https://github.com/adafruit/Adafruit_Python_ADS1X15
and then you can run exmaple from Adafruit_Python_ADS1X15's exmaples folder.
you will need to detect what busses you have and what devices. To list avilable busses:
i2cdetect -l
list features for bus:
i2cdetect -F 1
to dump addresses with devices on bus "1" do this:
i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-1. I will probe address range 0x03-0x77. Continue? [Y/n] Y 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --
now edit example pythons to use the values you found.
if you get:
"RuntimeError: Could not determine default I2C bus for platform."
then you installed Adafruit_Python_ADS1X15 but not Adafruit_Python_GPIO
i2c stuff
used adafruit wonderful clear funtional guide: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
Copied a python script from here htu21d.py https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=76688
https://github.com/dalexgray/RaspberryPI_HTU21DF
RTC Setup
did this, it worked:
http://www.raspberrypi-spy.co.uk/2015/05/adding-a-ds3231-real-time-clock-to-the-raspberry-pi/
temp + pressure
I'd like to do this:
BME280 I2C
http://www.raspberrypi-spy.co.uk/2016/07/using-bme280-i2c-temperature-pressure-sensor-in-python/
AWs IOT python style
http://docs.aws.amazon.com/iot/latest/developerguide/iot-device-sdk-c.html
https://github.com/aws/aws-iot-device-sdk-python
List of devices
name: pi
so very original.
- RTC
- temp sensor
- python send to aWS IOT MQ
- [/]
- notable Config.txt
dtparam=i2c1=on dtparam=i2c_arm=on dtparam=i2s=on dtparam=spi=on dtoverlay=dwc2 enable_uart=1 start_x=0 gpu_mem=16
- cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait modules-load=dwc2,g_serial
/etc/network/interface
# some comments source-directory /etc/network/interfaces.d auto lo iface lo inet loopback iface eth0 inet manual allow-hotplug wlan0 iface wlan0 inet static address 192.168.1.151 netmask 255.255.255.0 gateway 192.168.1.28 wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf allow-hotplug wlan1 iface wlan1 inet static wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
wpa suplicant
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=GB network={ ssid="gopher" psk="XXX" key_mgmt=WPA-PSK }
name: rubusnil
- Jessie
- nodejs --version v0.10.29
- Dual light sensors
- Pending middle ware ( node-red ? )
pi zero pinout
pi zero the original
[ 0.000000] Linux version 4.4.38+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #938 Thu Dec 15 15:17:54 GMT 2016 [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache [ 0.000000] Machine model: Raspberry Pi Zero Rev 1.3 [ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0x900093 bcm2708.serial=0xbcfc0185 smsc95xx.macaddr=B8:27:EB:FC:01:85 bcm2708_fb.fbswap=1 bcm2708.uart_clock=48000000 bcm2708.disk_led_gpio=47 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait [ 0.000000] Memory: 436516K/458752K available (6063K kernel code, 437K rwdata, 1844K rodata, 376K init, 726K bss, 14044K reserved, 8192K cma-reserved) ... [ 0.665568] raspberrypi-firmware soc:firmware: Attached to firmware from 2016-12-09 15:11
PI the inegrated wifi
WebCam
v4l2-ctl --list-devices --verbose -D -L
Microsoft LifeCam NX-3000 (usb-20980000.usb-1): /dev/video0 VIDIOC_QUERYCAP: ok Driver Info (not using libv4l2): Driver name : uvcvideo Card type : Microsoft LifeCam NX-3000 Bus info : usb-20980000.usb-1 Driver version: 4.9.35 Capabilities : 0x84200001 Video Capture Streaming Extended Pix Format Device Capabilities Device Caps : 0x04200001 Video Capture Streaming Extended Pix Format brightness (int) : min=0 max=5 step=1 default=-8193 value=2 contrast (int) : min=0 max=6 step=1 default=57343 value=3 saturation (int) : min=0 max=6 step=1 default=57343 value=4 hue (int) : min=-2 max=2 step=1 default=-8193 value=0 white_balance_temperature_auto (bool) : default=1 value=1 gamma (int) : min=1 max=2 step=1 default=57343 value=2 power_line_frequency (menu) : min=0 max=2 default=2 value=2 0: Disabled 1: 50 Hz 2: 60 Hz white_balance_temperature (int) : min=2600 max=6500 step=1300 default=19505 value=6500 flags=inactive sharpness (int) : min=0 max=9 step=1 default=57343 value=2 backlight_compensation (int) : min=0 max=1 step=1 default=57343 value=0 pan_absolute (int) : min=-36000 max=36000 step=3600 default=0 value=0 tilt_absolute (int) : min=-36000 max=36000 step=3600 default=0 value=0 zoom_absolute (int) : min=0 max=10 step=1 default=57343 value=0 brightness (int) : min=0 max=5 step=1 default=-8193 value=2 contrast (int) : min=0 max=6 step=1 default=57343 value=3 saturation (int) : min=0 max=6 step=1 default=57343 value=4 hue (int) : min=-2 max=2 step=1 default=-8193 value=0 white_balance_temperature_auto (bool) : default=1 value=1 gamma (int) : min=1 max=2 step=1 default=57343 value=2 power_line_frequency (menu) : min=0 max=2 default=2 value=2 0: Disabled 1: 50 Hz 2: 60 Hz white_balance_temperature (int) : min=2600 max=6500 step=1300 default=19505 value=6500 flags=inactive sharpness (int) : min=0 max=9 step=1 default=57343 value=2 backlight_compensation (int) : min=0 max=1 step=1 default=57343 value=0
dmesg
[ 4902.764657] Indeed it is in host mode hprt0 = 00021501 [ 4902.964546] usb 1-1: new high-speed USB device number 2 using dwc_otg [ 4902.964813] Indeed it is in host mode hprt0 = 00001101 [ 4903.198462] usb 1-1: New USB device found, idVendor=045e, idProduct=0721 [ 4903.198479] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [ 4903.198503] usb 1-1: Product: Microsoft LifeCam NX-3000 [ 4903.198510] usb 1-1: Manufacturer: Microsoft [ 4903.317047] media: Linux media interface: v0.10 [ 4903.362560] Linux video capture interface: v2.00 [ 4903.866314] uvcvideo: Found UVC 1.00 device Microsoft LifeCam NX-3000 (045e:0721) [ 4903.866827] usbcore: registered new interface driver snd-usb-audio [ 4903.877818] uvcvideo 1-1:1.0: Entity type for entity Processing 5 was not initialized! [ 4903.877851] uvcvideo 1-1:1.0: Entity type for entity Selector 4 was not initialized! [ 4903.877890] uvcvideo 1-1:1.0: Entity type for entity Camera 1 was not initialized! [ 4903.879831] input: Microsoft LifeCam NX-3000 as /devices/platform/soc/20980000.usb/usb1/1-1/1-1:1.0/input/input0 [ 4903.881492] usbcore: registered new interface driver uvcvideo [ 4903.881522] USB Video Class driver (1.1.1)
v4l2-ctl --list-formats-ext
what is is set to now?
v4l2-ctl -V
set it to something new:
v4l2-ctl -v height=640 -v width=480 -v pixelformat=YUYV
apt-get install vlc
cvlc v4l2:///dev/video0 :v4l2-standard= :input-slave=alsa://hw:0,0 :live-caching=300 :sout="#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{dst=:8080/stream.wmv}"
Then surf to http://192.168.1.151:8080/stream.wmv
Generic Setup process
Pre boot
- etcher
- rasbian image
- boot files:
config.txt
dtoverlay=dwc2 enable_uart=1 dtparam=i2c_arm=on dtparam=i2s=on dtparam=spi=on
serial speed: 115200
cmdline.txt
modules-load=dwc2,g_ether
empty ssh file in /
pi@raspberrypi.local
- wireless setup /etc/network/interfaces
allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
- wifi file: /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="Deluxe" scan_ssid=1 key_mgmt=WPA-PSK psk="XXX" } network={ ssid="gopher" scan_ssid=1 key_mgmt=WPA-PSK psk="XXX" }
secure user account
create user account.
give new account same groups as pi user.
lock down pi user
$id pi uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(input),109(netdev),997(gpio),998(i2c),999(spi)
make your new users like thepi user:
export USER="fartypants" for i in pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi do usermod -a -G ${i} ${USER} done for i in adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi do deluser pi ${i} done
AP relay setup
reference: https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md
+- Router ----+ | Firewall +-WIFI-(10.23.45.2)-))) (Internet)+ DHCP server | | + | +- AX1500 ----+ +-+-----------+ +-(192.168.1.114)-+ +-WIFI-(192.168.51.1)-))) | | | | +-LAN-(192.168.1.28)+ +-------------+ +- PiTwo ----+ | +-WIFI-(192.168.4.1)-))) (192.168.51.230)-WIFI-+ DHCP server| wlan1 wlx40a5ef0f87b6 | + dhcp----+ +------------+