A hotfix that fix a segfault when closing a session window in VSCP works is available. Binary is available here
In this howto we will build a simple VSCP level II node that with the help of a PIR motion sensor detects motion and sens this as a VSCP event wireless to a VSCP daemon.
We use the famous ESP8266 for this and work in the even more famous Arduino environment. The ESP8266 comes in many flavors but a convenient form factor is the NodeMCU board. You can buy it on Aliexpress or Ebay at a low-cost (USD 2.2).
The last item you need is the PIR sensor, they to are available at low-cost. I bought mine from Ebay (USD 0.99).
If you haven’t set up your Arduino IDE for work with the ESP8266 you need to do that now. Here is an excellent tutorial on how to do this. Make the blink example work before you move on.
I find the Arduino IDE a bit crude to work with so I use Visual Studio Code instead. An excellent programming editor that works on all the major operation systems. I tend to use it more and more. But there are other options to such as Atom. Anyway instructions on how to get it working for Arduino development is here. Make sure to set the “output” tag to a valid location in the .vscode/arduino.json file otherwise upload will be VERY slow.
You also need a VSCP daemon/server running for this example. All info about it is here.
To connect the sensor to the NodeMCU we ned to know about he port mapping for the module which is a bit different from for other Arduino devices. It looks like this
static const uint8_t D0 = 16; static const uint8_t D1 = 5; static const uint8_t D2 = 4; static const uint8_t D3 = 0; static const uint8_t D4 = 2; static const uint8_t D5 = 14; static const uint8_t D6 = 12; static const uint8_t D7 = 13; static const uint8_t D8 = 15; static const uint8_t D9 = 3; static const uint8_t D10 = 1;
D0 has a blue LED connected to it so it is an obvious candidate for status. D1 can be used to connect to the PIR
The PIR device I have outputs a 3V signal even when powered with +5V so it is OK to connect directly to D1. So the three pins on the PIR
1 +5V 2 Output to D1 (High on detect) 3 GND
The LED on D0 light up when a LOW is written to it. This is opposite to the PIR output. We take care of this in software.
We implement a dump VSCP device here. This is a device that does not handle any of the register reads that “normal” VSCP requires and which don’t have a MDF file either. A dumb device has been 14 set in the header.
We send two events. The heartbeat event (CLASS1.INFORMATION, Type=9) every minute. This event is recommended for all nodes as it is used for node discovery and detection. The other event we send is the detect event (CLASS1.INFORMATION, Type=49 detect) when an object is detected.
The test setup looks like this
and you can find the complete code is here
The heartbeat coming into the VSCP daemon (using VSCP works)
and the detect event
With the event in the VSCP daemon it is easy to add a DM row that for instance light up the lamps in a room. You can also use the rest or the websocket interface to do give visual feedback.
We will follow-up this howto with a post where we use the Expressif SDK instead of the Arduino and use a plain ESP8266 board. But also a ost where we implement a full Level II node that have registers and a MDF and show the advantage we get with a node like that over a dumb one.
Version 13.0.0 – Aluminium of VSCP & Friends has been released today. A lot of new stuff of course, much more than we can list here.
Download is here: https://github.com/grodansparadis/vscp/releases/tag/v13.0.0
Docs are here: http://www.vscp.org/docs/vscpd/doku.php
The Lua scripting implemention in the decision matrix of the VSCP server is now fully in place. Remote variables can now be handled and events can be received and sent.
More functionality such as tcp/ip communication capabilities will be added as we go.
This is the last addition before the Aluminium release.
It might not look beautiful looking at raw in the browser like this but this is a decision matrix row that runs a Lua script. The scripts can read/write VSCP remote variables and send/receive events. &That means you have a choice between JavaScipt and Lua when you want to do something when events are received by the VSCP server. Events that can be a measurement or something else like a pressed button.
Five more adds and after that some tests, then release. So soon now!
We today got an EUR 100 donation from https://www.webhostingsecretrevealed.net/hosting-revie/hostgator-review/ to the project.
In previous versions of VSCP whenever you did an install all configuration files were replaced with the latest version. This is not true anymore. Now the new version is instead written as a copy with the date of the install appended to it. So if you after a “make install” or a “dpkg -i vscpd” want the latest configs you have to copy the backup to the actual config file and restart the VSCP server.
Files that is handled in this way is
Also if you are on unstable code you should remove the databases before you start the updated server . Use
Also note that the web sample code is not installed in the install/update process no more. The process to get this subsystem installed with be described later.
The work with the upcoming 13.0.0 Aluminium release is moving on. As usual a few surprises has turned up adding some weeks to the work but things move forward as expected. Instead of being released before X-mas I now expect it to be out sometime late January next year.
For those of you doing home automation project I can recommend Domoticz and OpenHAB (in that order). Both projects has a huge and active user base constantly adding support for new devices. Much better choices for HA freaks than VSCP will ever be.
I also want to take the opportunity to wish all of you a merry X-mas. This year has been a quite rough time here and that will continue for some time but with the support from many of you I have managed to keep servers active and also had a chance to get some new hardware to play with as well. Thanks for your generosity. I will never forget.
There are a few days more coding for me before I turn of my computer and rest for a couple of days. A good book, some movies and a lot of food is waiting for me and honestly I need the rest. I hope all of you enjoy a few days rest also.
Be hungry, stay foolish