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

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.



Pagina de precios de electricidad


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

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): Requesting the monthly general IRE widget for the year 2018 (peninsular geo_limit; English): Requesting the yearly generation structure widget between 2014 and 2018 (ccaa geo_limit; Castilla la Mancha; Spanish):

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:


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 =
s = today.strftime(format)
output = s+' '+fetchtemp()+'\n'


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

Create this also


and paste the following:

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

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/ && /home/pi/plottemp/ &> /dev/null

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


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.


Install from GitHub:

ISS Tracker


Pagina donde se obtine la latitud y longitud de la estacion espacial



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 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


def informacion():
        jsonFeed = urlopen(feed_url)
        feedData =
        #print feedData
        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__":

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


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

*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.