Category Archives: VSCP

#VSCP interfaces howto

Something that may confuse new users of VSCP is the GUID of interfaces. Looking at the interface above the CAN4VSCP driver have GUID set to

FF:FF:FF:FF:FF:FF:FF:FE:B8:27:EB:0A:00:02:00:00

which means nodes connected to this interface will come in with GUID’s

FF:FF:FF:FF:FF:FF:FF:FE:B8:27:EB:0A:00:02:00:01
FF:FF:FF:FF:FF:FF:FF:FE:B8:27:EB:0A:00:02:00:02
FF:FF:FF:FF:FF:FF:FF:FE:B8:27:EB:0A:00:02:00:03
FF:FF:FF:FF:FF:FF:FF:FE:B8:27:EB:0A:00:02:00:04
....

If we look at the GUID’s if this machine we see that they all start with

FF:FF:FF:FF:FF:FF:FF:FE

As of  the spec we know that this is a GUID constructed from an Ethernet address. In this case only four of the six MAC digits is used. The

00:02

is the interface id as set by the VSCP daemon and the last two digits are the nickname id for a connected node.

The problem that can occur here is that the interface digits can be different at different runs of the VSCP daemon. The number is just set when the interface is set up and from time to time this setup can happen in different order. So sometime

00:02

can be

00:03

or even

00:11

One can’t tell beforehand.

This is a problem if one want to use the GUID to identify a node. Problematic as this is just what we want in most cases. To trigger on an event from a specific node in a decision matrix the GUID is the item to filter on. Just as in this case

Here we store a temperature measurement in a variable if it comes from a node with GUID

FF:FF:FF:FF:FF:FF:FF:FE:B8:27:EB:0A:00:02:00:01

and measurement index = 1

If the interface ordinal  becomes something else like

00:03

we are in trouble here as the action (store measurement value in variable) will not be triggered.

If we look at the current driver for this setup it is set to

 

<!-- The can4vscp driver -->
<driver enable="false" >
    <name>can4vscp</name>
    <config>/dev/ttyUSB1</config>
    <path>/srv/vscp/drivers/level1/vscpl1drv-can4vscp.so</path>
 <guid>00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00</guid>
    <flag>>0</flags>
</driver>

The “problem” is solved by changing the <guid> tag from an all zero value (or not defined) to a valid GUID.  If not defined or all zero the VSCP daemon will assign a GUID as of above. But if a valid GUID is set this value will always be used.

In my case I can use

01:00:00:00:00:00:00:00:00:00:00:00:01:02:00:00

as I have some assigned GUIDs.  The two LSB’s is still used for the nicknames.

After that change the “problem” is no more and I can filter on the new GUID instead which alway will be the same.

 

 

#VSCP measurement visualization #IoT #m2m

I just want to present some new stuff I have been working on during the last week. It is still initial work but still quite useful. Also beware. This is JavaScript, PHP and MySQL and I am an embedded programmer. But I have asked for help from people who know these things but got no response so here I go and do it myself as usual. If someone wants to step in and help or even take over this project he/she is more than welcome, I have tons of other things to attend to.

There will be a proper howto and a manual at a later stage.  This document is just some information and a demo.

First: Why?

Answer: I need this for my own use. Actually I needed it because I have two compost containers where I have temperature sensors and I was curious of the temperature in them now in the winter when it is cold. Well I have some other temperature sensors around the house and the office that maybe can tell me something also.

If you know VSCP you also know about the VSCP ux framework. It is really a nice set tools that allows for building fast, reliable, secure and responsive user interfaces with live data. It uses the websocket and the REST interfaces of the VSCP daemon to communicate between ux elements and the VSCP subsystem. We talk state of the art security here, at least if SSL is used. But sometimes it may feel awkward to export interfaces of an in operation/house critical piece of computer hardware anyway. This is therefore another way you can share data. A cloud solution if you like. But something you are in charge of yourself.

To use VSCP mv (VSCP measurement visualization) you need an Internet server provider that gives you a mysql/mariadb database. Most does, at least here in Europe. Well you can have your own server that do this also of course.

Secondly you setup the VSCP daemon to send the data you want to share. This you do by adding a decision matrix element to your local VSCP daemon.

Third you configure what data you want to share by adding some entries in the database.

Your are ready to go.

Now you can visualize your data

This is the temperature outside at my place. With the “select source” at the bottom you can look at the temperature in my office and in the mentioned compost containers. The interface works on different hardware, phones, tablets and computers.  Using iframes you can include it in other web pages. This is live and dynamic data.

This is another way to look at the same information. Some more variants of this may come in the future.

If you instead wants a diagram you have that here for the current day, which is the default. The diagram will update as time goes.  If you prefer to see the temperature 2018-03-16 between 00 and 03 you can of course.

And if you rather want to see the current temperature in my office  it is possible or in the compost 1 container or in the compost 2 container.

But if you rather just want to investigate data this collecting interface may be the best place to get a hold on it.

And there are all temperature measurements here. But don’t be fooled.  Any of the VSCP’s measurement values can be shown.

But…

you say. I want to use my own diagram/Table tool to visualize data. I will not stop you. It’s a free world. If you can read JSON your on

Read the defined seco devices.  SECO = SEnsor, COntrol. Or read the current value for a SECO.  Or read data in a date/time range for a seco.

As I said I will come back with a manual and a howto at a later point. Well a link to the software also of course.

For me the info that the microorganisms in the compost container holds it at zero degrees Celsius or just above was worth the effort in constructing this.

/Ake

#ESP8266 #VSCP Development Intro – part 1

Serial port

Connect the USB cable to the board.  You will get a new CDC serial port. You can check which one you get with

ls /dev/tty*

Normally you get /dev/ttyUSB0 or /dev/ttyUSB1 or the like. To make them usable for you you should add yourself to the dialout group

addgroup user dialout

where “user” is your username. You can also do this manually in the /etc/group file or

chmod a+rw /dev/ttyUSB0

if you like brute force.

Loading code to the ESP8266

The ESP8266 CPU can be booted in three different ways:

  • Flash Mode: default booting mode. Firmware is read and executed from the flash memory. Pins need to be set to: GPIO15=0, GPIO0=0, GPIO2=1
  • UART Mode: used to program our board (through a Serial-to-Usb adapter). Pins need to be set to:  GPIO15=0, GPIO0=1, GPIO2=1
  • SDIO Mode: loads firmware from an SDIO card? Pins need to be set to:  GPIO15=1, GPIO0=0/1, GPIO2=0/1

The boot process is described here.

Switching from a mode to another requires to reset the module while the pin states listed is set.

With the nodemcu board and esptool flash uploader all this is handle automatically but if you have another board you must handle this yourself.

esp-open-sdk

You find it here.

Fetch it

sudo git clone https://github.com/pfalcon/esp-open-sdk.git

cd esp-open-sdk

Install it

apt-get install make unrar autoconf automake libtool libtool-bin gcc g++ gperf flex bison texinfo gawk ncurses-dev libexpat-dev python sed

git clone --recursive https://github.com/pfalcon/esp-open-sdk

cd esp-open-sdk/

make
Error when building?  See this post
This builds the standalone version of the SDK (Non FreeRTOS)
You should add the bin directory to he path
echo 'PATH=$PATH:~/development/esp8266/esp-open-sdk/xtensa-lx106-elf/bin' >> ~/.profile

echo 'PATH=$PATH:~/development/esp8266/esp-open-sdk/esptool' >> ~/.profile

PATH=$PATH:~/development/esp8266/esp-open-sdk/xtensa-lx106-elf/bin
PATH=$PATH:~/development/esp8266/esp-open-sdk/esptool

I have installed the toolchain in

 ~/development/esp8266/ 

so change paths above for your installation folders.

Update it (when updates are available)

make clean
git pull
git submodule update

Firmware upload tool

You need the esptool.py to upliad firmware to the module, you find it here
Install with
pip install esptool

First code (blinky)

You find it here

cd ~/development/esp8266/esp-open-sdk/examples/blinky

Type

make

to build it. Remember that the paths above must have been set. You may get some warnings. No problem.

For your information. If you build from source code should be loaded like this:

  • bin/0x00000.bin to 0x00000
  • bin/0x10000.bin to 0x10000

That is just what we do here. Upload to your module with

esptool.py --port /dev/ttyUSB1 write_flash 0x00000 blinky-0x00000.bin 0x10000 blinky-0x10000.bin

No need to press any buttons during flashing. It is handled automatically by the USB DTR circuitry.

Now we are ready to do some real work for our VSCP system with the ESP8266.  If you rather prefer Arduino this howto may be the one you should go for instead of this one. Life is much simpler in the Arduino world. But the degrees of freedom is better if you do it all by yourself. The penalty for freedom is more problems of course. As always.

Another intro is here http://www.electrodragon.com/w/ESP8266_Open_SDK
esp8266 wiki is here.

Part 2 will follow.