oriolrius.cat

Des del 2000 compartiendo sobre…

Category: Technology

Video of the conference about my Smart Home in the IT Arena (Lviv,UA)

Reading time: < 1 minute Finally I have the chance to share with you the video of the conference that I gave some months ago. Remember it was about my low cost home automation systems, may be the most interesting thing will be that most of the presentation is a real time demostration aobut how I create those systems.

If you want to take a look of the presentation slides:

I hope it was interesting, or useful for you.

Tancant el 2016

Reading time: 10 – 16 minutes

Comencem parlant de la família, la casa i el poble…

Aquest any hem donat la benvinguda al 2017 des de Cuba; així doncs, durant aquestes vacances nadalenques envoltades per celebracions familiars la meva interacció amb l’ordinador ha estat pràcticament nula i per si fos poc durant les vacances no vaig connectar a Internet ni amb el mòbil. Sembla impossible, oi? doncs es pot fer i a més es posa molt bé. La veritat és que el mes de desembre va arribar amb una agenda pleníssima plena de compromisos personals i professionals. Tot plegat es va convertir en una cursa que ha acabat amb la tornada a la feina el passat dilluns dia 9. Així doncs tot i que amb retard ara toca fer el tradicional, i tan útil, resum anual.

dav

Com no pot ser d’una altre manera aquest any ha vingut marcat per una notícia meravellosament inqualificalble. Ben a principi d’any, concretament el 17 de febrer el Roc va arribar a les nostres vides i com tothom diu, perquè és ben cert, ens va canviar la vida per sempre. Ja res tornarà a ser igual i totes les prioritats que t’havies marcat amb aquells valors que creies que tenies tan marcats canvien totalment. Potser no és algo que passi realment de cop, almenys jo he anat necessitant el meu temps per anar-me’n adonant i comprovant com això era així però no es pot negar que ara el centre de l’univers és el Roc. És curiós perquè quan més miro el Roc més recordo el Pol, no és algo que m’entristeixi però evidenment hem posa nostàlgic i el trobo a faltar. Per sort, una bona abraçada del Roc ajuda a agafar forces per mirar endavant.

Ara mateix el Roc és a piscina, va a la llar d’infants i ja s’enfila per tot arreu. Amb quasi 11 mesos té unes ganes d’explorar el món increïbles i amb un somriure als llavis que realment et fan tenir ganes de dir-li t’estimo i fer-li mil petons. Algunes de les meves sanes rutines les he hagut de canviar, per exemple, he deixat spinning i ho he canviat per Befit que en menys temps faig un treball més complert pel cos. Per sort continuo poden practicar el tennis i la piscina ha quedat aparcada després d’un inici molt prometedor. Pel que fa al meu tema físic aquest any m’han hagut d’infiltrar el colze i la munyeca del braç dret perquè no podia jugar a tennis del dolor que tenia. Cal dir que des de llavors estic súper bé.

befit

A casa hem continuat fent obres, enrajolant diverses parts del jardí i deixant-ho tot apunt per acabar la zona de la barbacoa. Pel que fa al poble estic veient moltíssimes transformacions i grandíssimes millores, potser la última ha estat el centre d’interpretació de l’aigua. Però activitats com engalanar els carrers per la festa major i moltíssimes cosetes més hem fan notar que Torrelavit es modernitza i s’obre a la gent de fora. Com que els temps actuals no només porten bones coses, durant la nit de Sant Joan i estant de vacances a Sardenya ens varen entrar a robar a casa. Així que durant aquest any també hem hagut d’instal·lar una alarma a casa; mai hagués imaginat que això caldria al meu poble. Un lloc on durant molts anys havia aparcat el cotxe davant la porta de casa i amb les claus posades.

Per cert, pels més geeks que llegiu aquesta entrada, l’alarma que m’he posat és una G90B comprada a Aliexpress. Això si, també he comprat unes quantes càmares de videovigilància noves i un grabador. Diria que al proper que se li acudeixi entrar a casa tindrà un bon reportatge a més d’una bona festa de llum i sorolls quan entri. El millor de tot és que he aconseguit connectar els sitemes que he comprat amb el nou sistema domòtic de la casa.

Una altre taca negativa de la modernització del poble és que s’han registrat tres incèndis ben aprop del nucli del poble. Té tota la pinta que van estar provocats, però això encara no s’ha pogut demostrar lamentablement. Tristament en el darrer dels casos les flames van arribar fins al jardí d’una de les cases del barri. Per sort, tot es va poder resoldre en una mala tarda de diumenge i el millor és que el paissatge no ha quedat gaire malmès. Gràcies bombers.

La feina

Pel que fa a aspectes professionals, la companyia que vaig co-fundar fa uns anys ja no es diu M2M Cloud Factory, ara som “Nexiona, IoT connectocrats“. Aprofitant el MWC’16 el recent estrenat departament de marketing va fer el llençament de la nova marca. Però no només hem estat al MWC; hem tingut presència en altres fires com el METIC, WPC de Microsoft a Toronto, però sobretot on ho hem donat tot ha estat al IoT SWC de Barcelona. Durant l’any hem presentat el nou MIIMETIQ LITE; el MIIMETIQ EDGE que va acompanyat d’un hardware de DELL i fins hi tot hem tret productes no-oficials però que s’han venut a clients interessants com el MIIMETIQ Agent. Però a vegades, hi ha petites coses que acompanyen als productes que et fan tanta o més il·lusió, per exemple, finalment el serveis en els que es basa el sistema ja corren en contenidors de Docker, també disposem d’una interfícia gràfica per gestionar les actualitzacions i llicències del producte, a més d’un mòdul per demanar assistència remota de forma automàtica.

miimetiq-edge-promo

Cal dir també que hi ha algún dels nostres clients que han tret solucions realment interessants basades en els nostres productes. Com a ara Vadecity, que ofereix un servei de lloguer de parking per bicicletes a Barcelona. Alguna altre solució pot ser també el sistema de control d’impresores de gran format de Ricoh; o el més que original sistema de vacunació per pollastres d’Hipra que hem montat conjutament amb IBM. Tot plegat amb tecnologia Nexiona. Però la gran notícia de l’any és l’entrada en l’accionariat de l’empresa per part de Tech Data, un dels proveedors d’informàtica més grans del món. Cal dir que és un èxit que realment fa molta il·lusió.

També he pogut dedicar una estona als meus projectes

El més conegut i de moment el més llarg és el blog, aquest any ja ha fet 16 anys des de la primera entrada que hi vaig fer. Així que malgrat sempre arrossegues el sentiment de que voldries haver-hi compartit moltíssimes més coses cal estar content per haver continuat aquesta feina tenaç.

La infrastructura que tinc a casa i a Internet també ha canviat força, la cosa continua en plè procés de re-estructuració i els canvis es succeixen sense parar però algunes cosetes que puc rescatar podrien ser que he parat definitivament el servidor VMWare ESXi que tenia corrent sobre un HP Proliant ML100. Una de les migracions més difícils ha estat canviar el pfSense virtualitzat que hi tenia, el que he fet ha estat programar serveis equivalents dins del Mikrotik CloudSwitch que tinc. Creant-me fins a sis xarxes locals per separar el tràfic de diferents serveis que tinc a la xarxa local. Per exemple, tinc xarxes pels sistemes de seguretat; pels sitemes domòtics; per la veu sobre IP; pels serveis d’internet (DMZ) o per les persones. Fins hi tot m’he creat una xarxa on poso els equips en proves i que de moment no vull que afectin serveis en producció.

Referent als servidors dedicats que tenia a Internet, i que també eren màquines virtuals corrent en un gran servidor VMWare ESXi, els he migrat tots a VPS d’OVH amb l’objectiu de reduir radicalment els costos i baixar les necessitats de manteniment. Per tant ara amb dos servidors VPS i snapshots que faig periódicament m’asseguro que el pitjor que hem pot passar és haver de restaurar la màquina. També disposo d’un tercer servidor dedicat amb moltíssima més capacitat de disc per fer-hi còpies de seguretat.

Degut a tota aquesta migració durant l’any he publicat alguns articles que diria que cal resaltar:

Pel que fa a l’smart home (sistema domòtic) aquest any m’he centrat en refer el sistema de calefacció que tenia basat en Panstamp. El nou sistema usa ESP8266 a més d’estar montat fora de cada calefacció a diferència del vell, a més la lògica ara esta enmatzemada en el servidor i no en cada radiador; tota la programació de servidor va sobre NodeRED i per tant és molt senzill mantenir-la. Pel que fa a l’interficie d’usuari estic migrant d’OpenHAB a HomeAssistant, el nou sistema es basa en Python 3 i malgrat estar més verd m’hi trobo molt més còmode. Per desgràcia tot això no esta acabat i malgrat la inestimable ajuda del Dani i alguna altre persona el tema encara esta en fase alpha.

Algunes coses curioses, la primera que m’ha passat aquest any és que m’ha explotat la bateria del Macbook Air que ja tenia aparcat i que per cert tinc a la venta. Una altre és que en un viatge en avió vaig esquerdar la pantalla del portàtil Toshiba i hem va tocar canviar-la per una de nova.

Fins hi tot he donat alguna conferència

Aquest any la meva disponibilitat per assistir a events ha estat molt reduida, però encara he pogut donar tres conferències. Per ser més exactes, he participat en dues taules rodones sobre Industria 4.0; la primera al col·legi d’enginyers de Barcelona i l’altre durant el “Catalan Telecommunications day“. Però la que realment hem va fer més il·lusió sobretot perquè és el primer com que hem criden a parlar a un altre país és la que vaig donar a Lviv (Ucraïna) durant l’IT Arena. En aquesta ocasió vaig parlar sobre la meva “Smart Home” i a més vaig dedicar la major part de la xerrada a fer una demostració de com crear un automatísme per casa “low cost”.

IT Arena Oriol' speech

Aquest any també he pogut viatjar

Quan el Roc només tenia dos mesos vaig haver d’anar a Itàlia per temes de feina, així doncs, hem vaig emportar l’Estefania i el Roc i varem poder disfrutar de Cèrvia un petit poble de platja, a més de Bolònia i San Marino. Al cap de dos mesos aprofitant la baixa per maternitat de l’Estefania varem escapar-nos una setmaneta a Sardenya; aquest cop varem viatjar en vaixell, no en avió, les vacances varen estar molt xules tot i que va costar una mica manegar el Roc perquè li van sortir les seves primeres dues dents durant aquella setmana.

També hem fet algunes escapades durant els ponts de l’any a Viella, Puigcerdà i fins hi tot a Menorca on ens hi varem escapar amb el Xavi, la Sabina i les bessones per cel·lebrar el seu aniversari de casament. Però el viatge estrella de l’any ha estat l’escapada a Cuba. Des del 27 de desembre fins el 5 de gener varem poder gaudir de l’hospitalitat cubana. La Havana vieja ens va encantar i el resort turístic del Ocean Varadero “El Patriarca” ens va permetre descansar i disfrutar moltíssim no només del Roc, sinó també de la companyia dels cunyats.

Sense la família a part del viatge a Ucraïna per fer la conferència també he viatjat a Florida, més concretament a St. Petersburg i Clearwater; aprop de Tampa. Tot plegat arrant de la visita als HQ de Tech Data en motiu de la seva entrada a Nexiona. A més de visitar uns quants cops anglaterra per visitar alguns clients, per cert, després de molts anys vaig poder tornar a estar a Oxford realment una ciutat molt interessant.

dav

Using Homie for a temperature sensor

Reading time: 2 – 2 minutes

The second episode of ESP8266 programming series. In the next video I describe how to code a firmware for ESP8266 using Arduino IDE. The purpose of that firmware is create a temperature sensor and publish the reading in a MQTT broker.

Schema of the system:

temperature-sensor-schema

Pictures of the system, I used ESP12E Devkit and some cheap parts:

dav

mde

mde

References in Aliexpress where I bought the hardware:

thermistor psu

Firmware source code is publishied in my github account: temperature sensor source code for ESP8266.

Homie as a convention for MQTT based IoT solutions

Reading time: < 1 minute In this video I describe deeply a convention called "Homie“; thanks to that we have a set of rules and assumptions very useful when a firmware device is created and/or an IoT platform have to be configured to support those devices. I love that convention and I used it during my demonstration scenario in Lviv IT Arena.

After this video I’ll follow a series of some other videos, describing how to develop devices following Homie conventions.

Official documentation of the convention can be found in the Github Homie project.

Conference: Smart Home using low cost components at IT Arena, Lviv (UA)

Reading time: 2 – 2 minutes

Last weekend I talked on IT Arena event organized in Lviv (Ukraine) at Lviv Arena Stadium created for the Football Eurocup of 2012. It was a very good and well organized event, it was a privilege to participate. I gave a presentation about the automation’s that I created latest years at home thanks to the open software and open hardware. The second part of the presentation was a demonstration about how to set up some IoT devices created ad-hoc.

speech

If you want to review the slides, they are available at slideshare.

Conference was recorded but for a while I don’t have the video clip, if I can get access to the video I’ll upload it to youtube and referenced here. Anyway I created a photo album that you can review in LVIV trip pictures photo album.

IT Arena Oriol' speech

Finally I want to give thanks to Mykhaylo Kramarenko because thanks to his invitation I had that great opportunity. Thanks to Marta Maksym to take care of my trip and accommodation. Thanks to organizers for the 3G SIM card with data and free calls, next time a micro-SIM card will be perfect for my mobile phone XD and last but not least a lot of thanks to Denis Kolesnikov for his guided visit to the Lviv center, really nice place I’ll go back to visit it properly.

Table about Industry 4.0 on Catalan Telecommunications day

Reading time: 3 – 4 minutes

Last Thursday I participated in a round table about Industry 4.0 as part of the Catalan Telecommunications Day, really interesting event in a very nice place. I haven’t been in Cosmo Caixa since it was called “Museu de la Ciència” a very long time ago. But I have to say that the place is very trendy and awesome.

diada-telecom

Coming back to the event, I met some good friends and it’s always a pleasure but I also meet very interesting new people with who I’ll be happy to keep on talking and going deep on aligning synergies. One of those are i2cat people, guys we have to find the proper way to collaborate because again and again we meet each other with very compatible points of view.

taula8

About the content of my exposition I want to remark two things:

  • Firstly I think we have the debt to leadership the fourth industrial revolution, and catch up all those companies that never did the third revolution no the present. Catalonia has very powerful minds with a lot of entrepreneurs now it’s time to work together and demonstrate what we can do.
  • Secondly summarize the Fernando Trías de Bes article in “La Vanguardia”
    • In the 90s they said that Internet is going to be like another TV channel in our TVs; companies only need to create a Web page and they are ready for the future. But in the end it changed the ‘P’ of product in the marketing strategy.
    • Early 2000 e-commerce get it real and they said that it’s only another distribution channel, but finally it has been the change of two ‘P’s point of sale and price, both of them became obsolete.
    • In 2006 the revolution come through the social networks, they said only this is only personal webs instead of enterprise web; just create some accounts in those social networks and that’s all.  But ‘P’ of promotion has been redefined with new market segmentation.
    • Since 2010 smartphones sales increased dramatically and they said this is just like a mini PC, just adapt web pages and everything is done. But a lot of markets disappeared or changed deeply: photo cameras, music CDs, telephony, etc. So ‘P’ of point of sale and ‘P’ of product totally redefined. Virtual and physical experiences unified.
    •  First decade of new century Internet 2.0 has been consolidated, they said this is just web where people can participate. Companies only need to add a corner in their webpages where can discuss. ‘P’ of prices digital money and a lot of new business models.
    • Currently we talk about IoT and they say this is about adding electronics to the physical world.  Instead of that what happen is all product in a digital environment tends to be converted in a service. Again the ‘P’ of product is obsolete and has to be totally redefined.

diadatelecos2016123

Having that in mind IMHO we have huge opportunities within reach.

Restricted user for SSH port forwarding

Reading time: 2 – 2 minutes

I love “ssh -R” reverse SSH is really useful when you have to get access to a Linux machine behind a NAT or firewall. One of the most powerful scenarios to get that running is use a third machine with a public IP address. The idea will be run reverse SSH command in target Linux and publish a forward port at the third server, so you only have to connect to a published port in that third server and you’ll get the target Linux thanks to the reverse SSH connection open between them.

reverse-ssh-schema

A long time ago I talked about that in my podcast “2×04 SSH avançat“.

With this scenario we have a security challenge with the SSH user account on the “third server”, we want a secure user:

  • without shell and sftp access
  • secure enough to only allow port forwarding features
  • access only allowed with authorized keys

I’m not going to give precise Linux instructions on that limited user, but for user you’re not going to have problems to get that:

/etc/passwd(-):

limited-user:x:1001:1001::/home/limited-user:

/etc/shadow(-):

limited-user:!:17037:0:99999:7:::

/etc/ssh/sshd_config:

Match User limited-user
    GatewayPorts yes
    ForceCommand echo 'This account can only be used for maintenance purposes'

Of course, you’ll have your own UID, GID and use your own username. And at “/home/limite-user/.ssh/authorized_ssh” you’ll have to pub public key of the clients that want to use the service.

I’ve got my inspiration to get that from: How to create a restricted SSH user for port forwarding?. Thank you askubnutu.com.

Ubuntu server as wifi AP and Mikrotik as a DHCP server

Reading time: 2 – 3 minutes

It’s important to have a very clear picture about the scenario that we’re going to configure in that case because it’s a little bit particular. This is an evolution of the previous post: Ubuntu server as wifi AP and Mikrotik as a DHCP server

schema

There is a server running Ubuntu 16.04 and offering wifi service as an AP. The wifi interface is in bridge mode with the ethernet port and send all traffic to the Mikrotik gateway where there is a DHCP server in charge to serve IP address to wifi clients.

Start by configuring the bridge in the Ubuntu server. File “/etc/network/interfaces”:

source /etc/network/interfaces.d/*

auto lo br0
iface lo inet loopback

#ethernet interface
allow-hotplug enp2s0
iface enp2s0 inet manual

#wifi interface
allow-hotplug wlp3s0
iface wlp3s0 inet manual

# Setup bridge
iface br0 inet static
    bridge_ports enp2s0 
    address 192.168.2.2
    netmask 255.255.255.0
    network 192.168.2.0

Pay attention on “bridge_ports” the wifi interface is not added on the list, this is because until the hostapd is running it doesn’t make sense to do that. You’ll see “bridge=br0” option on hostapd.conf which will fix that misbehavior.

Wifi AP configuration, “/etc/default/hostapd”:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

and “/etc/hostapd/hostapd.conf”:

bridge=br0                # bridge interface
interface=wlp3s0          # wifi interface name
driver=nl80211
ssid=the_ssid_name        # name of your network
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=the_secret_key   # secret key to joing with the wifi network
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
logger_syslog=-1
logger_syslog_level=3
logger_stdout=-1
logger_stdout_level=1

DHCP server configuration on Mikrotik:

# setting the interface address, in my case ether4
/ip address
add address=192.168.2.1/24 interface=ether4 network=192.168.2.0

# setting up DHCP on interface 4 of the mikrotik device
/ip dhcp-server
add address-pool=dhcp-pool disabled=no interface=ether4 name=dhcp-pool

# network of the DHCP server
/ip dhcp-server network
add address=192.168.2.1.0/24 dns-server=8.8.8.8 domain=your_network.local gateway=192.168.2.1 netmask=24

# IP pool used by the DHCP server
/ip pool
add name=dhcp-pool ranges=192.168.2.65-192.168.2.70

Cookbook: set-up a TFTP server on Ubuntu

Reading time: 1 – 2 minutes

Sometimes TFTP is the only protocol available to exchange files with an embedded system. So, it’s very easy to have that supported in our workstation or any other place to exchange files with those systems.

Set up steps:

apt-get install tftpd-hpa

modify file “/etc/default/tftpd-hpa”:

TFTP_OPTIONS="--secure --create"

–secure: Change root directory on startup. This means the remote host does not need to pass along the directory as part of the transfer, and may add security. When –secure is specified, exactly one directory should be specified on the command line. The use of this option is recommended for security as well as compatibility with some boot ROMs which cannot be easily made to include a directory name in its request.

–create Allow new files to be created. By default, tftpd will only allow upload of files that already exist. Files are created with default permissions allowing anyone to read or write them, unless the –permissive or –umask options are specified.

Needed to allow uploads in that directory:

chown -R tftp /var/lib/tftpboot

Restart and check if the service is running:

service tftpd-hpa restart
service tftpd-hpa status
netstat -a | grep tftp

New home server working as a wifi AP and DHCP server

Reading time: 2 – 3 minutes

At the beginning of August I’ve received a new home server, I decided to stop my old HP ML110 G5 and substitute that by a new silent and low power server also based on Intel technologies in this case it’s al i5 with 8G of RAM and 128GB of SSD for less than 300€ including custom costs I think it’s a very good investment.

fmp03-geekbuing

 

I installed Ubuntu 16.04 LTS server, I don’t tried de Win10 pre-installed. I happy to see a very new and powerful BIOS with tons of options. But in this blog entry I want to explain how to set-up the wifi card as a wifi AP. I didn’t have to do anything to configure the card. It worked by default.

Ralink corp. RT3090 Wireless 802.11n 1T/1R PCIe

The first thing is check if the wifi network is compatible with the AP mode.

iw list
...
Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
         * mesh point
...

Next thing is install the “hostapd” which is going to take care to set-up the AP. The configuration file have to be something like that “/etc/hostapd/hostpad.conf

interface=wlan0   # change that with the wifi interface name
driver=nl80211
ssid=test         # your wifi network name
hw_mode=g
channel=1         # look up for a free channel
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=1234567890   # passwor to join the wifi network
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Modify “/etc/default/hostapd” and put that:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Start the hostapd service:

sudo service hostapd start

Now the AP is running but a DHCP service giving IPs it’s need, I used “isc-dhcp-server”. First thing to configure is “/etc/default/isc-dhcp-server” with the wireless network name:

INTERFACES="wlan0"

Next file to be configured is “/etc/dhcp/dhcpd.conf”:

ddns-update-style none;
log-facility local7;

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.128 192.168.1.253;
    option domain-name-servers 192.168.1.1;
    option routers 192.168.1.1;
}

Don’t forget to start the service:

sudo service isc-dhcp-server start

If it’s needed remember to create the proper iptables rules and enable “ip_forward” in /proc filesystem. I’m not going to describe that because in my case it’s not going to be useful.

This is not a specially interesting post entry but useful as a reference, when you have to use a fast and easy cookbook to setup a wifi AP.