VSCP L1 arduino library
- How to send a VSCP event?
- Decision Matrix
- Issues, Ideas and bugs
The Very Simple Control Protocol (VSCP), an open and free protocol for IoT/m2m automation tasks.
More information can be found on the main site http://www.vscp.org
This is a arduino library of the VSCP software framework for level 1 devices. It provides several layers according to the VSCP specification.
Recommended is to connect a LED, which shows the node state.
Mandatory is to connect a push button, used to start the node nickname discovery. Similar as shown in the Seeed-Studio CAN-BUS Shield example.
How to send a VSCP event?
Define a transmit message
Prepare the transmit message
That means to add the node nickname, the hardcoded flag, the class, the type and the priority.
vscp.prepareTxMessage(txMsg, VSCP_CLASS_L1_INFORMATION, VSCP_TYPE_INFORMATION_ON, VSCP_PRIORITY_3_NORMAL);
Add the class and type specific data.
txMsg.data = 1; // Index txMsg.data = 0; // Zone txMsg.data = 0; // Sub zone txMsg.dataNum = 3;
Send the event.
You will find a template for the module description file here: https://github.com/BlueAndi/vscp-arduino/blob/master/mdf_template.xml
How to use it, please take a look to the VSCP specification.
By default the decision matrix is enabled at page 1, offset 0 and provides about 10 rows. If you need more rows, please change them in the
#define VSCP_CONFIG_DM_ROWS 20
with the number of rows at the end.
The generic example shows the basic integration of the VSCP arduino library.
Seeed-Studio CAN BUS Shield
This example assume that the CAN BUS Shield from Seeed-Studio is used, as well as the corresponding CAN controller library.
- Shield: http://www.seeedstudio.com/wiki/CAN-BUS_Shield
- Library: https://github.com/Seeed-Studio/CAN_BUS_Shield
- If you use the CAN terminal instead of the sub-d, don't forget to wire GND too! It may work over a short distance, but no guarantee.
Sparkfun CAN-BUS Shield
This example assume that the CAN-BUS Shield from Sparkfun is used. Because they provide no arduino library, the MCP2515 library from Frank Kienast is used.
- Shield: https://www.sparkfun.com/products/10039
- Library: https://github.com/franksmicro/Arduino/tree/master/libraries/MCP2515
How to install it?
Follow the following installation instruction for libraries here: https://www.arduino.cc/en/Guide/Libraries#toc4
How to use the VSCP-framework in the code?
Please take a look to the provided examples because they guide you through all necessary things like
- Create a VSCP instance
- Calling the setup() method with some important parameters.
- And etc.
Where to find all the VSCP class defines and their corresponding types?
You will find the class defines here:
You will find the type defines here:
src/framework/vscp_type_alarm.h src/framework/vscp_type_control.h src/framework/vscp_type_display.h src/framework/vscp_type_information.h src/framework/vscp_type_measurement.h src/framework/vscp_type_measurezone.h src/framework/vscp_type_phone.h src/framework/vscp_type_protocol.h src/framework/vscp_type_remote.h src/framework/vscp_type_security.h src/framework/vscp_type_weather.h src/framework/vscp_type_weather_forecast.h
Does the library only support the CAN-bus as transport protocotol?
No, the library is not limited to the CAN-bus protocol. It might look like, because of the examples above. But thats because I only use the CAN-bus as transport protocol at home and I don't have e. g. a RS-485 shield.
Therefore the library supports the silent node behaviour too, which is used for non-multimaster protocols. Enable it in the configuration src/framework/vscp_config_overwrite.h via
#define VSCP_CONFIG_SILENT_NODE VSCP_CONFIG_BASE_ENABLED
Issues, Ideas and bugs
If you have further ideas or you found some bugs, great! Create a issue or if you are able and willing to fix it by yourself, clone the repository and create a pull request.
The whole source code is published under the MIT license.