ESP8266 NodeMCU 1.0 + RF 433MHz transmitter + wireless outlet + Blynk

Hello, there is very fast and impresive project for home IoT. One night during normal browsing I find arduino library for controll 433MHz wireless outlet which is laying around for few years without usefull task. After few minutes I completed all need parts from drawer and put all together. Afer half of hour I had functional 2ch android controlled sockets. Good think to implement to project is Wifimanger library for easy SSID/pass change without reprogram ESP. In this fast project I omited it…

https://github.com/sui77/rc-switch

https://github.com/tzapu/WiFiManager

http://www.ebay.com/itm/433Mhz-WL-RF-Transmitter-Receiver-Module-Link-Kit-for-Arduino-ARM-MCU-Wireless-/380717845396?hash=item58a48d4b94:g:x9cAAMXQigBSMp4X

Screenshot_2016-03-17-23-38-26

20160317_230920

/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
*   Downloads, docs, tutorials: http://www.blynk.cc
*   Blynk community:            http://community.blynk.cc
*   Social networks:            http://www.fb.com/blynkapp
*                               http://twitter.com/blynk_app
*
* Blynk library is licensed under MIT license
* This example code is in public domain.
*
**************************************************************
* This example runs directly on ESP8266 chip.
*
* You need to install this for ESP8266 development:
*   https://github.com/esp8266/Arduino
*
* Change WiFi ssid, pass, and Blynk auth token to run :)
*
**************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

//——– rcswitch——
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = „dlaskjdlaskjdlasdjjasld“; //insert here your token generated by Blynk

void setup()
{
Serial.begin(9600);
Blynk.begin(auth, „Internet“, „Secretpass123“); //insert SSID…

mySwitch.enableTransmit(4);  //D2 on NodeMCU module

}

void loop()
{
Blynk.run();
}

//——-rcswitch——
BLYNK_WRITE(0) {  //virtual pin 0
mySwitch.switchOn(„01111“, „10000“);
}

BLYNK_WRITE(1) {
mySwitch.switchOff(„01111“, „10000“);
}

BLYNK_WRITE(2) {
mySwitch.switchOn(„01111“, „01000“);
}

BLYNK_WRITE(3) {
mySwitch.switchOff(„01111“, „01000“);
}

MCU controlled constant power load – battery discharger arduino + ESP8266

There is my DIY discharging device. Design is inspired from site (big thanks):

Building a Constant Current/Constant Power Electronic Load

I added ACS712 current measure module and ESP8266 for mail alert, when discharge is complete and result report via blynk mail widget.

Another improvement is paralel cables for precise measure load volage.

Update: uploaded arduino sketch with my library folder, wireless AC socket for charger controll is added! look at photo!

20160318_234219

20160318_234237

ESP8266_load load_libraries

 

 

Alcoma ASD + Wine + USB serial

Pokud potrebujete provozovat ASD Clienta pod linuxem ve Wine, zde je navod:

So, here is what I did to make it work. First of all, unless you want to run Wine each time as root, add yourself to the dialout group, so you can access serial ports without root permissions. This can be done from Terminal:

sudo adduser <your_username> dialout

You should log off and back in for the changes to take effect. This affects not only Wine, but all other Linux application that need serial port access.

The first step is to make the necessary symbolic links. Again, in Terminal:

ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1
ln -s /dev/ttyS0 ~/.wine/dosdevices/com2

Adapt these commands for your situation. The first one is needed if you use a serial to USB adapter while the second one is for hardware motherboard ports. Add a symbolic link for each of the available serial ports. This command actually gives access to serial ports from Wine. And any Windows software where you can manually edit the serial port will work with only this. However many Windows apps allow user to select a port from a detected ports list. And they will detect nothing in Wine.

Now you need to add a Wine registry key as stated on Strangen0tes blog. Although you could use Wine’s regedit, it is easier to launch a text editor and add the required registry key(s). In Terminal:

gedit ~/.wine/system.reg

What you should add here is not clearly known, so you should try with the following options from Wine Wiki until you find something that works.

This is the common option that works with most applications:

[Hardware\\Devicemap\\Serialcomm] 1231984861
"Serial0"="COM1"

The other one is:

[Hardware\\Devicemap\\Serialcomm] 1131331688
"COM1"="COM1"

Both worked for me. Yet there may be apps that don’t read this registry key when looking for serial ports.

The association between COMx and /dev/ttyX is made in the symbolic link you made earlier.

CM5024Z Raspberry Pi rs-232 solar controller python script

I bought 50A PWM solar controller from ebay for power my shack. Controller have RS-232, so let’s it connect to raspi and read voltage!

File with protocol details and example:

CM30_COM

Device photo:

solar_controller

#!/usr/bin/python
import serial, sys
ser = serial.Serial('/dev/ttyUSB0', 9600)

command = "\x01\x10\x00\x00\x00\x00\x2B"

ser.open() # !!! in new version PySerial need comment
ser.flushInput() #clear buffer
ser.write(command) #send prepared command
#time.sleep(1) #maybe solve problems 
skip=ser.read(2) #skip first two bytes
byte3=ser.read(1)
byte4=ser.read(1)
ser.close()

value1=ord(byte3)
value2=ord(byte4)

voltage=(value2 * 256 + value1) / 100
voltage_modulo=(value2 * 256 + value1) % 100

#print(repr(byte3))
#print(repr(byte4))

sys.stdout.write(str(voltage))
sys.stdout.write('.')
sys.stdout.write(str(voltage_modulo)

UBNT AirFiber24 repair oprava

Nejaky cas zpet nam po bource prestala fungovat jednotka AirFiber24 od Ubiquity. Dlouho mi to tu lezelo na skrini, az me kolega vyhecoval a otervel jsem ten zazracny porouchany stroj. Po promereni menice bylo hned jasne, ze bude pravdepodobne spaleny integrovany obvod menice a mozna i neco dalsiho. Jedna se o IC UCC2809P-2 a napeti za sekundarem jsou 4V a 6V. Nez jsem se pustil do shaneni noveho IC, napojil jsem na filtracni kondenzatory za menicem dva zdroje 3.3V a 5V abych zkusil, jestli to neni marne snazeni. Jednotka se rozsvitila, zacla odpovidat na ping a dostal jsem se i do web. rozhrani, super! Zacal jsem tedy patrat po netu ale nic moc. Nakonec jsem napsal primo do TI aby mi poslali vzorek a za dva dny tu byly dva kusy! Jednotka po vymene nabehla normalne z POE a zatim se zda vsechno v poradku. Cekam nyni na zapujceni dalsiho kusu, abych je mohl vyzkouset proti sobe a celou akci uzavrit. Jednotku vsak nehodlame nasadit do ostreho provozu ale nechame si ji v pripade, ze bude fungovat, jen jako nahradnika – par spoju v siti mame…

EDIT: Oprava se povedla, jednotka se spojila s druhym kusem na plnou kapacitu. Moc me to potesilo.

20150820_21381720150820_21384120150821_100314

APC SMX750I smart UPS external battery pack hack

V siti pouzivame na nekterych bodech UPS od firmy APC konkretne model SMX750I. Vydrz samotne UPS neni nic moc, protoze obsahuje pouze 4ks CSB HR1234W F2, 9Ah, 12V slozenych do 48V akupacku coz je jen nejakych papirovych 432Wh, vzaje v potaz ucinnost UPS a skutecnou kapacitu aku pri vysokych vybijecich proudech, dostaneme se klidne treba jen na pulku. Proto APC dodava k UPS battery packy kde je 8ks (4+2 serio-paralelne) vyse zminenych aku a tedy dalsich 864Wh, coz je stale malo. Proto jsem se rozhodl pripojit k UPS poradnou baterii. Z prvniho zkoumani bylo jasne ze to nebude otazka dvou dratu protoze propojovaci konektor ma 4 piny viz foto.

ups_battery_con

ups_battery_dps

Proto jsem battery pack otevrel a zjistil schema:

ups_battery_pack

Snadno tedy zjistime ohmetrem, ktery z pomocnych pinu je na kostre a ktery je „informacni“. Je tedy jasne, ze UPS detekuje BP podle odporu na pinu. Pokud pripojime dva originalni BP je vysledny odpor 5k coz je paralelni soucet dvou 10k odporu. Vyrobce uvadi maximalni pocet 5ks ext. battery packu coz je max. vysledna kapacita 4320Wh. Ja jsem koupil 4ks 12V 75Ah baterii coz je 3600Wh coz odpovida 4ks orig. battery packu, proto bud vezmeme 4ks 10k rezistoru a dame je paralelne nebo spocitame ze vysledny odpor je 2.5kohm a pripojime proti minus polu naseho batterypacku a je to.

tabulka hodnot jak to vychazi podle koupeneho akupaku:

1 10k 864Wh 4x18Ah
2 5k 1728Wh 4x36Ah
3 3.33k 2592Wh 4x54Ah
4 2.5k 3456Wh 4x72Ah
5 2k 4320Wh 4x90Ah

Po pridani informacniho odporu 2.5k se odhadovana vydrz zvedla z 30min na 6h

Testovani olovenych baterii

Ve firme pouzivame velke mnozstvi Pb aku a po case pouzivani je potreba zjistit jestli je aku v poradku. Po uvazovani jak to spolehlive zjistit jsem dospel k zaveru, ze nejlepsi bude baterii nabit a potom ji vybit konstatnim vykonem do umele zateze a po dosazeni kritickeho napeti 1.75V/clanek coz je u 12V aku 10.5V zatez odpojit a vypocitat uzitecny vykon.

Jako prvni testovaci objekt jsem pouzil aku CSB 12V 65Ah (http://eshop.micronix.cz/akumulatory-a-baterie/zalozni-akumulatory/csb-battery/gp12650-i.html) ktery jsme stahli z provozu asi po roce pouzivani ve standby rezimu

Jako zatez jsem pouzil menic 12V>230V s pripojenym 150W halogenem. Jako celek se sestava chova vcelku podle pozadavku jako 160W zatez i s funkci odpojovace – podle mereni ma menic, ktery jsem pouzil ucinost do odporove zateze peknych 93%. Podle jmenovite kapacity by v akumulatoru melo byt 780Wh (12V x 65Ah). Test dopadl prekvapive dobre cas behu menice byl 3.75h coz je nejakych 600Wh.

Dalsim krokem bude stavba elektronicke zateze rizena MCU abych mohl simulovat ruzne situace pro ruzne akumulatory a mel na konci mereni jasny udaj na displayi. Patral jsem proto na webu az jsem vypatral projekt ktery resi presne to, co jsem zacal vymyslet a dokonce na nej nekdo dalsi navazal a udelal i DPS. Uvidime co se bude dit dal ale ja si rozhodne jedek kus se zatizitelnosti min. 150W postavim.

http://www.kerrywong.com/2013/10/24/building-a-constant-currentconstant-power-electronic-load/

 

Svatky v Asterisku

Pokud pouzivate FreePBX asi se vas to netyka ale pokud potrebuje vyresit stavky vcetne velikonocniho pondeli v dialplanu asterisku, muze se vam nasleduji navod hodit.

Prvne naplnime databazi Asterisku klici s daty:

asterisk -rx ‚database put holiday 0101 1‘
asterisk -rx ‚database put holiday 0501 1‘
asterisk -rx ‚database put holiday 0508 1‘
asterisk -rx ‚database put holiday 0705 1‘
asterisk -rx ‚database put holiday 0706 1‘
asterisk -rx ‚database put holiday 0928 1‘
asterisk -rx ‚database put holiday 1028 1‘
asterisk -rx ‚database put holiday 1117 1‘
asterisk -rx ‚database put holiday 1224 1‘
asterisk -rx ‚database put holiday 1225 1‘
asterisk -rx ‚database put holiday 1226 1‘
asterisk -rx ‚database put holidayeaster 20160328 1‘
asterisk -rx ‚database put holidayeaster 20170417 1‘
asterisk -rx ‚database put holidayeaster 20180402 1‘
asterisk -rx ‚database put holidayeaster 20190422 1‘
asterisk -rx ‚database put holidayeaster 20200413 1‘
asterisk -rx ‚database put holidayeaster 20210405 1‘
asterisk -rx ‚database put holidayeaster 20220418 1‘
asterisk -rx ‚database put holidayeaster 20230410 1‘
asterisk -rx ‚database put holidayeaster 20240401 1‘
asterisk -rx ‚database put holidayeaster 20250421 1‘

 

klic holiday obsahuje ve formatu MMDD mesic a den statniho svatku, klic holidayeaster obsahuje ve formatu YYYYMMDD datum velikonocniho pondeli do roku 2025.

V dialplanu je potom mozne vyuzit data takto:

exten => s,n,Set(ISHOLIDAY=${DB_EXISTS(holiday/${STRFTIME(${EPOCH},,%m%d)})}) ;kontrola zda neni svatek
exten => s,n,GotoIf($["${ISHOLIDAY}" = "1"]?svatek) ;pokud ano, skace na label svatek
exten => s,n,Set(ISEASTER=${DB_EXISTS(holidayeaster/${STRFTIME(${EPOCH},,%y%m%d)})}) ;kontrola velikonocniho pondeli do roku 2025
exten => s,n,GotoIf($["${ISEASTER}" = "1"]?svatek) ;pokud ano, skace na label svatek

 

Oprava graficke karty v notebooku Acer Aspire 5920 zapekanim reflow

Pred nekolika dny se mi zastavil OS Windows 7 blue screenem kde stalo ze prestal odpovidat ovladac graf. jadra a konec. Po restartu bylo videt jako kdyby ve framebufferu byly nejake chyby a projevovalo se to ruznymi pravidelnymi poruchami v obraze uz pri startu BIOSu. Abych doplnil celou situaci, stalo se to potom co jsem se nejakou dobu koukal na mjpeg ze dvou kamer a asi to trosku vytizilo GPU/CPU a graf. karta to nejak nedala…

Pokračování textu