https://sethrobertson.github.io/GitFixUm/fixup.html#discard_all_unpushed
borrar y otras magias de git
Pedir imagenes a un nodo
Los nodos reciben comandos en el canal de comandos MQTT. Es a través de ese canal que luego enviaremos las solicitudes programadas durante el día. Sin embargo, al momento, la forma más fácil de enviar comandos al dispositivo, y esto incluye el comando de subir fotos, es a través de la consola de Google Cloud.
En la sección de IoT Core, debes seleccionar el registro de flowwatch y el dispositivo al que quieres enviar el comando. Dentro, aparecerá una vista similar:
Ahí debes presionar Send Command, y ahí insertar el siguiente JSON:
{
“kind”: “upload_picture”, “args”: “2020-10-20T21:22”,
“sentTimestamp”: 1603235636,
“uuid”: “c5d7e2ab-91de-475d-8ac3-351274cf6a23”
}
Donde sentTimestamp es un timestamp UNIX del momento en el cual se envió el comando. El uuid lo puedes ignorar por el momento, pero en el futuro nos permitirá identificar los comandos y sus resultados. Lo importante de momento es que en el parámetro args indices el momento del que quieres la foto (recuerda, al minuto y en el formato que aparece ahí).
Después de eso, se debiese crear el registro en Firestore y subir la foto a Cloud Storage.
Alias y bash
https://www.raspberrypi.org/documentation/linux/usage/bashrc.md
Usar exec bash
para actualizar
Lista de alias a la fecha (01/12/2020)
alias gs='git status'
alias activate='source /home/pi/ecohyd/venv/bin/activate && cd /home/pi/ecohyd/flowwatch-firmware'
alias temp='/opt/vc/bin/vcgencmd measure_temp'
alias webserver='/home/pi/ecohyd/flowwatch-firmware/webserver/webserver.py'
Cámara
Conexiones se revisan con el siguiente comando
pi@raspberrypi:~ $ vcgencmd get_camera
supported=1 detected=1
Otorgar más ram al GPU
Reporte de avance con prototipo 2
Tuve que comprar algunos materiales que me faltaban, llegaron hoy a las 11. Hice pruebas y ya tengo funcionando la version que permite uso de panel solar, pero que además incorpora el LEDIR con control por software (así podemos apagarlo
Lo que falta:
agregar ventilador (voy a probar cuanto consume porque no puedo controlarlo, estaría siempre encendido)
cerrar caja logger
Integrar webserver con el firmware (así mandamos datos a la nube de zenply)
Prueba general
En la entrega pasada hace unas semanas, al final con las pruebas entendí que el LEDIR se debía poder apagar por la batería , espero que ahora pasemos las pruebas, estoy optimista al respecto
Instalar python 3.8
sudo apt-get install -y build-essential tk-dev libncurses5-dev \
libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev \
libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev
version=3.8.5
wget https://www.python.org/ftp/python/$version/Python-$version.tgz
tar zxf Python-$version.tgz
cd Python-$version
./configure --enable-optimizations
make -j4
sudo make altinstall
Installs Python into /usr/local/bin
HINT
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
Backuo linux image (sd card)
https://magpi.raspberrypi.org/articles/back-up-raspberry-pi
The simplest way to back up your Raspberry Pi is to copy the entire SD card as an image.
This technique is the reverse of flashing your SD card when installing an OS to it. Instead of copying an image file from your computer to the SD card, you copy the entire SD card to an image file on your computer.
This is, in fact, how image files are created in the first place.
Power down your Raspberry Pi and remove the SD card. Place it into an SD card reader and connect it to your computer.
Open a Terminal window on a Mac or Linux computer, and enter df. Take a look at what drives you have on your system. Now attach the SD card to your computer, and enter df again.
Spot the newly mounted drive: on a Linux machine, it will be something like /dev/sdb1, and on a Mac it will say /dev/disk2s1. The numbers may be different, so be sure to check carefully.
On Linux:sudo dd bs=4M if=/dev/sdb of=raspbian.img
On a Mac:sudo dd bs=4m if=/dev/rdisk2 of=raspbian.img
You can then use the raspbian.img file to restore your entire operating system (in its current state) to an SD card using dd in reverse, or by using an app such as Etcher (etcher.io) to flash the SD card.
launch script at boot
https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup#method-2-autostart
Activar UART (maxbotix)
Disable Linux serial console
By default, the primary UART is assigned to the Linux console. If you wish to use the primary UART for other purposes, you must reconfigure Raspberry Pi OS. This can be done by using raspi-config:
- Start raspi-config:
sudo raspi-config
. - Select option 3 – Interface Options.
- Select option P6 – Serial Port.
- At the prompt
Would you like a login shell to be accessible over serial?
answer ‘No’ - At the prompt
Would you like the serial port hardware to be enabled?
answer ‘Yes’ - Exit raspi-config and reboot the Pi for changes to take effect.
Crear carpeta para llaves SSH
You have to create the .ssh
directory and the authorized_keys
file the first time.
Create the .ssh
directory
mkdir ~/.ssh
Set the right permissions
chmod 700 ~/.ssh
Create the authorized_keys
file
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
The permissions are important! It won’t work without the right permissions!
Now you can add the public key to the authorized_keys
file:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
You have to add the public key of your computer to the authorized_keys
file of the computer you want to access using SSH Keys!
As terdon mentioned you can also just use this command:
ssh-copy-id user@host
This will put your id_rsa.pub
(in your ~/.ssh
directory) in the remote computer’s authorized_keys
file, creating the .ssh
directory and authorized_keys
file with the right permissions if necessary.
Tomado de