# ethtool eth1
Settings for eth1:
        Supported ports: [ MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 9
        Transceiver: external
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: d
        Link detected: yes

Activar Wake on Lan

# ethtool -s eth0 wol g


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

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.

Cálculo exponencial

Cálculo exponencial usando python:

import sys
#Calculate the exponential 

def iterPower(base, exp):
    base: int or float.
    exp: int >= 0
    returns: int or float, base^exp
    if base==1 or exp==0:
        return 1
    if base ==0:
        return 0
    for index in (range(exp-1)):
    return resultado

def main():
        print ("Faltan argumentos\nUsar como base_exp.py [base] [exponente] ")
if __name__ == '__main__':



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): 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.

Run app at startup

Editing rc.local

On your Pi, edit the file /etc/rc.local using the editor of your choice. You must edit it with root permissions:

sudo nano /etc/rc.local

Add commands to execute the python program, preferably using absolute referencing of the file location (complete file path are preferred). Be sure to leave the line exit 0 at the end, then save the file and exit. In nano, to exit, type Ctrl-x, and then Y.

Edit RC Local File Configure Run a Program On Your Raspberry Pi At Startup

If your program runs continuously (runs an infinite loop) or is likely not to exit, you must be sure to fork the process by adding an ampersand (“&”) to the end of the command, like:

sudo python -u /full/path/main.py /dev/null 2>&1 &

The Pi will run this program at bootup, and before other services are started.  If you don’t include the ampersand and if your program runs continuously, the Pi will not complete its boot process. The ampersand allows the command to run in a separate process and continue booting with the main process running.

Now reboot the Pi to test it:

sudo reboot

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'


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

Create this also

nano plottemp.sh

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


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 https://api.wheretheiss.at/v1/satellites/25544


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


def informacion():
        jsonFeed = urlopen(feed_url)
        feedData = jsonFeed.read()
        #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.