Crypto

Install on Ubuntu via PPAs

The easiest way to install go-ethereum on Ubuntu-based distributions is with the built-in launchpad PPAs (Personal Package Archives). We provide a single PPA repository that contains both our stable and development releases for Ubuntu versions trusty, xenial, zesty and artful.

To enable our launchpad repository run:

sudo add-apt-repository -y ppa:ethereum/ethereum

Then install the stable version of go-ethereum:

sudo apt-get update
sudo apt-get install ethereum

Or the develop version via:

sudo apt-get update
sudo apt-get install ethereum-unstable

The abigen, bootnode, clef, evm, geth, puppeth, rlpdump, and wnode commands are then available on your system in /usr/bin/.

Find the different options and commands available with geth --help.

Ad-Hoc Connection

You can simply use the iwconfig tools on the both your Pis to join to an ad-hoc network.

use the following:

sudo iwconfig wlan0 mode ad-hoc channel 01 essid my-net

You can use your Link-Local addresses to interact with the pis in general.

A smart way to know your local network Pis can be to use:

ping -I wlan0 224.0.0.1

It is a Multicast Address which will give your pings from the Pis which have the same ad-hoc parameters.

This should most definitely give you the 169.254.x.x address of the Pi within the ad-hoc network.

Networking upon next boot

In best case use the following in your (both Pis) /etc/rc.local file:

sudo nano /etc/rc.local

iwconfig wlan0 mode ad-hoc essid my-net channel 01
exit 0

and add brcmfmac in to your /etc/modules file for availability of chipset on boot.

For further help I have a GitHub repository which can set up Pis (any model 2 or 3) in Ad-Hoc mode with IPv6 Link Local Addresses.

Electricidad

Tarifaluzhora

Pagina de precios de electricidad

https://tarifaluzhora.es/

REE

Obtener los datos del coste de la electricidad. Información de como gestionar los datos API.

https://www.ree.es/es/apidatos

1.4 Example requests

Below are listed a few example requests combining several query parameters:

Requesting the daily balance widget for January (default geo_limit; Spanish): https://apidatos.ree.es/es/datos/balance/balance-electrico?start_date=2019-01-01T00:00&end_date=2019-01-31T22:00&time_trunc=day Requesting the monthly general IRE widget for the year 2018 (peninsular geo_limit; English): https://apidatos.ree.es/en/datos/demanda/ire-general?start_date=2018-01-01T00:00&end_date=2018-12-31T23:59&time_trunc=month&geo_trunc=electric_system&geo_limit=peninsular&geo_ids=8741 Requesting the yearly generation structure widget between 2014 and 2018 (ccaa geo_limit; Castilla la Mancha; Spanish): https://apidatos.ree.es/es/datos/generacion/estructura-generacion?start_date=2014-01-01T00:00&end_date=2018-12-31T23:59&time_trunc=year&geo_trunc=electric_system&geo_limit=ccaa&geo_ids=7

Lectura Corriente

Luego ya sería adquirir tantos sensores no intrusivos como necesitemos: SCT-013-000.

Temperature on a Raspberry Pi

The below example guides you through how to plot your CPU temp as a graph to an image file, the code is in my github repository where I’ll hopefully add further functionality in the future.

How to guide

First off you need to install Python3

sudo apt-get install python3
sudo apt-get install python-setuptools
sudo apt-get install python3-pip

Next install GNUPlot

sudo apt-get install gnuplot-x11

Then we need to setup a working directory:

cd ~
mkdir plottemp
cd plottemp

create the necessary files:

nano datagen.py

Paste in the following code:

#!/usr/bin/env python

import sys, os, logging, urllib, datetime

def fetchtemp():
	cmd = '/opt/vc/bin/vcgencmd measure_temp'
	line = os.popen(cmd).readline().strip()
	output = line.split('=')[1].split("'")[0]#+' C'
	return output 

format = "%Y-%m-%d,%H:%M:%S" 
today = datetime.datetime.today()
s = today.strftime(format)
output = s+' '+fetchtemp()+'\n'

print(output)

with open('/home/pi/plottemp/tempdata.dat', 'a') as f:
	f.write(output)

Create this also

nano plottemp.sh

and paste the following:

#!/bin/bash
echo "set terminal png size 900, 300
set xdata time
set xrange [ time(0) - 86400 : time(0) ]    # 86400 sec = 1 day
set timefmt '%Y-%m-%d,%H:%M:%S'
set format x '%H:%M'
set output '/home/pi/plottemp/tempplot.png'
plot '/home/pi/plottemp/tempdata.dat' using 1:2 with lines" | gnuplot

make it executable

chmod +x plottemp.sh

next all we have to do is to run the script every 5 minutes (or whatever interval you choose) with cron:

crontab -e

and add this line:

*/5 * * * * python3 /home/pi/plottemp/datagen.py && /home/pi/plottemp/plottemp.sh &> /dev/null

and there we have it, it will generate a file called:

plottemp.png

The result

If you have successfully implemented the instructions you should get something like this:

How it works

I’ll very briefly walk you through how it works – there’s a cron job running every five minutes which firstly runs a command line function which reports the CPU temp and saves it to a log file. Upon completion it then runs a GNUPlot command to generate a graph of the last 24 hours logging.

Download

Install from GitHub:

https://github.com/sduro/temperatura.git

ISS Tracker

Introducción.

Pagina donde se obtine la latitud y longitud de la estacion espacial https://api.wheretheiss.at/v1/satellites/25544

{«name»:»iss»,»id»:25544,»latitude»:-49.286361096358,»longitude»:-79.112974058659,»altitude»:435.51955173138,»velocity»:27541.325742835,»visibility»:»daylight»,»footprint»:4585.5919346302,»timestamp»:1609618348,»daynum»:2459217.3419907,»solar_lat»:-22.833735560553,»solar_lon»:237.96509928192,»units»:»kilometers»}

Fuente: https://wheretheiss.at/w/developer

ISSTracker (Version 1)

Having researched trackers there are lots of sites that provide handy APIs to get the current latitude and longitude of the space station.  I settled on using wheretheissis.at as this provided the most comprehensive information I could find in an API.

All the coded needed to do was pull down the JSON provided by the API then parse the data for the values it needed. Below is an extract to show you how this is done

#!/usr/bin/env python3

from urllib.request import urlopen
import json
import time

feed_url="https://api.wheretheiss.at/v1/satellites/25544"

def informacion():
    try:
        jsonFeed = urlopen(feed_url)
        feedData = jsonFeed.read()
        #print feedData
        jsonFeed.close()
        data = json.loads(feedData)
        return data
    except Exception:
        import traceback
        print ("generic exception: " + traceback.format_exc())
 
    return []       
 
#use this method to retrieve from web API
def parseISSDataFeed():
    data = informacion()
    if len(data) == 0:
        return []

    name = data['name']
    lat = data['latitude']
    lng = data['longitude']
    alt = data['altitude']

    return [name, lng, lat, alt]

def main():
        print (parseISSDataFeed())

if __name__ == "__main__":
    while(1):
        time.sleep(1)
        main()


Now to display the ISS.  The visible globe is essentially half of a sphere and so represents 180º in both the latitude (top/bottom or North/South) and longitude (left/right or East/West).  With only 8 pixels that means each LED represents 22.5º of the Earths’ surface.

To display the location of the ISS we take the current lat/long of its position over the Earth and map that to the pixel/LED it falls into.  That’s all well and good when it’s on the “visible” side of the globe in the overlay, but what to do when it goes “behind” our overlay?

Rather than make the ISS “disappear” I opted to still display it but in a different colour so it can be tracked as it reappears on the visible side of our globe.  So now the LED lights up yellow for the visible side of the globe and blue when the ISS passes over the horizon to the rear of the planet.

Cómo instalar una pantalla LCD de 3.5

Instalación

Conecta el LCD a la Raspberry Pi, debe retroiluminarse la pantalla.

Abre un Shell a la raspberry.

Antes de empezar, verifica que tienes conexión a internet y actualiza apt-get:

sudo apt-get update
sudo apt-get upgrade

1 – Borramos por si hubiera restos de alguna instalación anterior:

sudo rm -rf LCD-show

2 – Clonamos repo git en local:

git clone https://github.com/goodtft/LCD-show.git

*Si da un error por no encontrar git lo instalamos con:

sudo apt install git

Y repetimos paso 2.

3 – Damos permisos de ejecución:

sudo chmod -R 755 LCD-show

4 – Entramos en el directorio

cd LCD-show/

Verás que hay muchos drivers, debes seleccionar el específico a tu LCD, ójo, no todos los 3.5 son iguales!.

Lista de dispositivos con su instalador correspondiente:

2.4″ RPi Display(MPI2401) –> sudo ./LCD24-show
2.8″ RPi Display(MPI2801) –> sudo ./LCD28-show
3.2″ RPi Display(MPI3201) –> sudo ./LCD32-show
3.5″ RPi Display(MPI3501) –> sudo ./LCD35-show
3.5″ HDMI Display-B(MPI3508) –> sudo ./MPI3508-show
3.2″ High Speed display(MHS32) -> sudo ./MHS32-show
3.5″ High Speed display(MHS35) -> sudo ./MHS35-show
4.0″ High Speed display(MHS40) -> sudo ./MHS40-show
4.0″ HDMI Display(MPI4008) –> sudo ./MPI4008-show
5.0″ HDMI Display-B(Capacitor touch)(MPI5001) -> sudo ./MPI5001-show
5.0″ HDMI Display(Resistance touch)(MPI5008) -> sudo ./LCD5-show
7.0″ HDMI Display-B-800X480(MPI7001) –>sudo ./LCD7B-show
7.0″ HDMI Display-C-1024X600(MPI7002) -> sudo ./LCD7C-show

Si quieres volver a utilizar la salida HDMI –> sudo ./LCD-hdmi

En mi caso es un 3.5»Raspberry LCD Driver: ILI9486, SKU: MPI3501, así que ejecuto la instalación:

sudo ./LCD35-show

Comenzará a descargar los paquetes necesarios y reiniciará.

Cuando arranque ya tendrás activo tu lcd y verás toda la info por pantalla.

Durante el arranque, la pantalla está unos segundos en blanco, es normal.