Friday, 2 June 2017

SOLVED: Something went wrong. Please try to check out again. Error Code: 70205


Easy to fix this problem:

Just use "Add to cart" button, then go to cart and check-out !!
Don't use the "Buy It Now" this time and it will work :-)



Works for me every time


Wednesday, 24 May 2017

T12 Soldering Station - STM32 / 1.3" OLED / V2.1S / Intelligent Edition



This is the model I finally chose to buy for a Soldering Station after a relatively extensive search and comparison of options. And I'm very happy I did so..

This is the one I got.

Being able to somehow adjust the temperature of the Soldering Iron is probably the most important thing. You can't use the same 'set up' to solder SMD components and the terminal of a helicopter's Li-Po battery..
For most of the years so far, I was using a top quality ANTEX iron connected through a circuit, found in an ELEKTOR magazine, about 25 years ago. And I was pretty happy with that, until I broke my last tip. The cost to buy a new one was more than double of that of a cheap Chinese Hakko clone.


Very good quality of all the components.

The power supply has proper isolation from the mains. All the materials and components are of above average qualiy.

The socket at the back includes the fuse and a lighted switch.
The anodisation of the body looks good and durable. Everything fits perfectly.
There is a piece of dark plastic (PlexiGlass?) that fits in the front panel. It acts as a filter for the display and gives a depth to it. I like that the display is not directly exposed. It is a quite easy to scratch and very very snug to fit in the front panel. I actually like the snug fit because you don't have to add glue or anything.
It even fits perfectly on top of the ATTEN 858D :)


Menu & Intelligent part

This station can actually work with any soldering iron you connect.
It will auto-detect what type of thermocouple the iron uses.
It will use the vibration switch to go into sleep mode when not in use, but it will still use timer if there is no such a switch.


more information on these features and schematics, coming soon...

Saturday, 15 April 2017

openHAB BlueTooth presence detection (Raspberry Pi)

Assuming you run openHAB on a Linux device,
there is a simple way to have any mobile or other BT device detected.

bluetooth-dongle

First, of course, you need a bluetooth device!
Any cheap usb dongle should work fine.
I use an old Bluetooth 2.0 with no issues. I didn't have to install any drivers on Raspberry.

Then you need to install 2 packages:
bluez & python-gobject
like this:

sudo apt-get install bluez
sudo apt-get install python-gobject

Now, in the folder configurations/scripts (or any other) create script file e.g bt_scan.sh containing:

#!/bin/bash

    DEVICES="$(hcitool name XX:XX:XX:XX:XX:XX)"

    if [[ $DEVICES = "Mi Phone" ]]
    then
      mosquitto_pub -t /home/bt/boss -m "OPEN"
    else
      mosquitto_pub -t /home/bt/boss -m "CLOSED"
    fi


replace XX:XX:XX:XX:XX:XX with your mobile's BT mac address and Mi Phone with your mobile's BT Name.
What this script does, is it runs the command
hcitool name XX:XX:XX:XX:XX:XX
which will return your mobile's BT Name, if it is detected. If it is not it will return nothing.
In my case the name it returns is Mi Phone.
If the phone is detected, the script will publish the string OPEN to the MQTT Broker /home/bt/boss
With this mosquitto broker and openHAB you can do anything you like, turn on lights, deactivate alarms, etc..

Finally, add a line in your cron jobs to get this script run every minute or so..
In the file /etc/crontab add the line

*  *    * * *   root    /etc/openhab/configurations/scripts/bt_scan.sh

And you are done.


Using this approach, you don't actually need openHAB.
You can have the linux box running the mosquitto and the ESP8266s controlling the lights, alarms, etc..

VStarcam C7824WIP IP Camera - ONVIF, RTSP, OpenHAB, VLC, Raspberry Pi

All the commands to control the camera over HTTP.
Tilt, Video stream quality, InfraRed light, Save & Call preset positions, etc..

A very good IP camera overall.
Definitely not perfect, but for this price range, it will fulfill most of the purposes.
Very very well made.
VStarcam C7824WIP 720P
270° Horizontal (Pan), 80° Vertical (Tilt)
2-Way audio. Audio is loud and clear both ways.
Receiving audio from the camera is possible through RTSP to any VLC player or any ONVIF application.
Sending audio TO the camera, is only possible through their app (Eye4) or Internet Explorer..

- - - - - - - - - - - - - - - - -


Details:


The camera default login username/password is written on a sticker underneath.
Usually: admin/888888

The IP address is set to auto, so connect the camera to a network (with DHCPd active) with a cable first.
Lets assume the camera gets the IP: 192.168.1.XX
- - - - - - - - - - - - - - - - -

You can configure all settings by visiting: http://192.168.1.XX:81/
- - - - - - - - - - - - - - - - -

RTSP Stream:


For VLC and ONVIF you can connect to the video stream here:

rtsp://admin:888888@192.168.1.XX:10554/udp/av0_0
rtsp://admin:888888@192.168.1.XX:10554/udp/av0_1

the resolution will be 1280x720 in the first case, and 640x480 in the second.
Video encoding: H264
Audio:G.711 A-law

- - - - - - - - - - - - - - - - -

HTTP Stream:



http://192.168.1.XX:81/videostream.cgi?user=admin&pwd=888888
Video quality is VGA or QVGA
no Audio

- - - - - - - - - - - - - - - - -

The Commands:


to select VGA(640x360) http streaming:

http://192.168.1.XX:81/camera_control.cgi?user=admin&pwd=888888&param=15&value=0

to select QVGA(320x180) http streaming:

http://192.168.1.XX:81/camera_control.cgi?user=admin&pwd=888888&param=15&value=1

to switch IR light to AUTO (on):

http://192.168.1.XX:81/camera_control.cgi?user=admin&pwd=888888&param=14&value=0

to switch IR light to OFF:

http://192.168.1.XX:81/camera_control.cgi?user=admin&pwd=888888&param=14&value=1

to move the camera by ONE STEP:


UP:
http://192.168.1.XX:81/decoder_control.cgi?loginuse=admin&loginpas=888888&onestep=1&command=0

DOWN:
http://192.168.1.XX:81/decoder_control.cgi?loginuse=admin&loginpas=888888&onestep=1&command=2

LEFT:
http://192.168.1.XX:81/decoder_control.cgi?loginuse=admin&loginpas=888888&onestep=1&command=4

RIGHT:
http://192.168.1.XX:81/decoder_control.cgi?loginuse=admin&loginpas=888888&onestep=1&command=6


It's pretty simple, you just add login, password, command and value to the HTML.


LEFT_UP:    command=90
RIGHT_UP:   command=91
LEFT_DOWN:  command=92
RIGHT_DOWN: command=93
STOP:       command=1

If you set onestep=0 the camera will start moving to the given direction until it reaches the end, or you can send a STOP command:

UP_STOP:    command=1
DOWN_STOP:  command=3
LEFT_STOP:  command=5
RIGHT_STOP: command=7

This is useful to simulate a "joy-stick like" tilt handling..
You need to set a toggle, so when a direction button is pressed will send the move (with onestep=0) command, and when the button is released, a STOP command will be sent.

Re-Center the camera: command=25
VERTICAL_PATROL:      command=26
VPATROL_STOP:         command=27
HORIZONTAL_PATROL:    command=28
HPATROL_STOP:         command=29

There is memory option for 16 pre-set positions that you can recall at once.
Manually move the camera to the desired position and save it as position 1 with this command:
http://192.168.1.XX:81/decoder_control.cgi?loginuse=admin&loginpas=888888&command=30&onestep=0&sit=30

and recall it at any time with this command:
http://192.168.1.XX:81/decoder_control.cgi?loginuse=admin&loginpas=888888&command=31&onestep=0&sit=31

So on, you can use the 16 available memories:


        POS      VAR
SET      1        30
CALL     1        31
SET      2        32
CALL     2        33
....
SET     16        60
CALL    16        61

- - - - - - - - - - - - - - - - -

OpenHAB:


The camera can be fully controlled from OpenHAB.
In Sitemap you can create Switches with mappings, for example:

Switch item=Cam2_Qlty mappings=[0="VGA", 1="QVGA"]

and in Items you use these values to execute the commands:

Number  Cam2_Qlty  "Quality"  <HQ>  {http=">[*:POST:http://192.168.1.XX:81/camera_control.cgi?user=admin&pwd=888888&param=15&value=%2$s]"}

or

Number  Cam2_Qlty  "Quality"  <HQ>  {exec="*:curl \"http://192.168.1.XX:81/camera_control.cgi?user=admin&pwd=888888&param=15&value=%2$s\" "}

- - - - - - - - - - - - - - - - -

Raspberry Pi:


Install VLC on a headless Raspberry, insert a usb stick, and then initiate a 10 minutes recording:


vlc "rtsp://admin:888888@192.168.1.XX:10554/udp/av0_0" --sout=file/ts:/media/usb1/Recording/Cam2_$(date +"%Y%m%d%H%M%S").avi -I dummy --run-time=600 vlc://quit

You can trigger this recording with a motion sensor or a DHT22 temperature sensor, door contact, bluetooth or whatever..

- - - - - - - - - - - - - - - - -

Android:


Onvifer is an app that definitely worth checking. It will auto discover any ONVIF compatible camera but you can also manually add any older you may have.
You get full control over the camera, sound, recording, etc.
It will also work outside your LAN if you do the port forwarding for 81 and 10554 !!

- - - - - - - - - - - - - - - - -

Great quality




- - - - - - - - - - - - - - - - -

Thanks


If you found anything interesting here and you are considering buying this camera or any other, I would appreciate if you use these links.
It is the best price and service anyway..

Sunday, 22 May 2016

RGB lights with openHAB & MQTT & ESP8266

So, you want to control an RGB Led or strip or anything, probably using the ESP8266..
It sounds pretty basic and straight forward, but for some strange reason it isn't.


We will use a Colorpicker in openHAB to get a string with three values in the form of RED,GREEN,BLUE.
This string will be sent over IP using MQTT.
An ESP8266 running NodeMCU firmware will get this string and transform it to 3 distinct PWM outputs.
A simple circuit with 3 N-channel MOSFETs can drive any reasonable RGB load..
openHAB and mosquitto run on a Raspberry Pi B+

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1)  Create a rule in openHAB's configurations/rules folder like this:

import org.openhab.core.library.types.*

/**
* This is a rule for the RGB_LED-Stairs
*/ 
var HSBType hsbValue
var String allValue

rule "Set RGB-Stairs value"
   when
   Item RGB_Stairs changed
   then
   hsbValue = RGB_Stairs.state as HSBType

   allValue = hsbValue.red.intValue + "," + hsbValue.green.intValue + "," + hsbValue.blue.intValue

   postUpdate(RGB_Stairs_rgb, allValue)
end


allValue is a string that gets the RED,GREEN,BLUE value.
RGB_Stairs_rgb is a name I used for my openHAB's item (you can choose different).
If you want to control more than one RGB Leds, you will need to create another similar rule in a DIFFERENT file..


2)  Create two items in openHAB like this:

Color    RGB_Stairs       "RGB Stairs"   <slider>   (All)
String   RGB_Stairs_rgb   "Stairs-RGB"   <switch>   { mqtt=">[broker:/home/RGB/stairsR/RGB:state:*:default]" }



3)  Create an item in sitemap, like this:

Colorpicker item=RGB_Stairs


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

That's it for openHAB.
I also included it in persistence so the colorpicker gets saved and restored in case of a restart. For that to work, you need to include the Color item in the persistance, not the String (for some strange reason). In my example that is "RGB_Stairs".
Also, not all persistence options will work correctly. db4o and rrd4j work, but mapdb and logging don't (at least for me).

Of course, this will only save and restore the state of the colorpicker in openHAB page, not the actual state of the RGB lights.
To save and restore the actual lights state I used some lua code to save the values in a file. It works OK, but ESP8266 starts misbehave after about a month! If I just re-upload the code, starts working properly again.
If I don't use file access in the code, it stays reliable for months..

 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

The circuit i used with ESP8266 looks like this:

The mosFETs I used are actually the SI2300.
They turn fully ON with 3.3V and handle more than 5Amps.
They are pretty cheap too.

Remember that the sequence of the colors in an RGB strip, is actually G,R,B

 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

The lua code looks like this:

pwm.setup(5, 970, 0) --GPIO.14
pwm.setup(6, 980, 0) --GPIO.12
pwm.setup(7, 990, 0) --GPIO.13
color = {}
-- START
m = mqtt.Client("ESP03-Stairs-RGB", 180, "", "")
-- ON mqtt receive..
m:on("message", function(mpla, topic, input)
-- MQTT is RED,GREEN,BLUE
  RED,GREEN,BLUE = input:match("([^,]+),([^,]+),([^,]+)")
-- convert 0-100 -> 0-1023
  RED = RED*10.23
  GREEN = GREEN*10.23
  BLUE = BLUE*10.23
-- do
  pwm.setduty(5, RED)
  pwm.setduty(6, GREEN)
  pwm.setduty(7, BLUE)
end)
-- if SUBSCRIPTION fails.. RESTART
m:on("offline", function(recon)
  print ("restarting...")
  node.restart()
end)
-- MQTT CONNECT when wifi ready (main routine)
tmr.alarm(0, 2000, 1, function()
  if wifi.sta.status() == 5 and wifi.sta.getip() ~= nil then
  tmr.stop(0)
    m:connect("192.168.1.20", 1883, 0, function(conn) print("Connnected")
       m:subscribe("home/RGB/stairs/RGB", 0, function(conn) print("Subscrbd") end)
    end)
  end
end)


I use a bit different PWM frequency for each color, in an attempt to reduce the flickering.
1KHz PWM is the maximum for the ESP8266 using NodeMCU.