Matlab Integration - Starting a fake Modbus device - volttron

For Matlab integration before we have a real connection to a physical controller. I want to start working with a fake Modbus device.
Below the script that I am using to start a fake Modbus device, after activating volttron:
python scripts/scalability-testing/virtual-drivers/modbus.py ~/git/volttron/examples/configurations/drivers/catalyst371.csv 127.0.0.2 --no-daemon --port 5020 --debug-output
Please, how to make the integration with a fake device successfully.
Thanks,
Error message

The message you are seeing is normal output for the fake modbus device. It's successfully setup all of the registers in the csv file as registers on the device.
The next step is to setup a modbus device driver in VOLTTRON and point it at the local host port 5020.
You can find the documentation for the Master Driver Agent (the platform interface Agent for devices) here: http://volttron.readthedocs.io/en/master/core_services/drivers/Driver-Configuration.html
Installing Agents is done with the script scripts/install-agent.py (see the help message for instructions).

Related

Load USB Gadget Mass Storage module from C

Development platform: TI davinci processor with Linux OS
I am developing C program which receives user command over serial port and does the corresponding task. Basic task is to start and stop the video recording. And for retrieving the video to host pc from the embedded device, usb interface is used.
The partition used for storing the video file is loaded as USB gadget mass storage device using following kernel module for the user to save the video on host pc.
modprobe g_file_storage file=/root/usbstorage
But i want to load(or some otherway) this kernel module from the c function whenever user send a command to connect the embedded device to host. And disconnect whenever disconnect command is received.
As of now I'm able to load this module only from the shell.
Could any suggest any possible way of doing this from within the c-program.

BLE Bridge Mode in Linux example

I want to use Bluetooth(4.0) on my board to transmit it's Name so any Mobile Application can see it's name and Mobile application initiates the pairing and connection with my Bluetooth.
I have seen some examples of Bluetooth(4.0) scanning nearby devices; For example:- It does scan for Bluetooth Mouser/Keyboard, but in this case Bluetooth(4.0) is in mode where it chooses the device it want to connect while I want it reverse so Any mobile application can see my Bluetooth and gets connect with it and does communication.
How can I put my Bluetooth(4.0) in such mode in Linux? Is there any C library using which I can put Bluetooth(4.0) is the mode where it goes in Bridge mode instead of scanning nearby devices?
You can set the name of your device like this:
hciconfig name "foo"
and check your name with:
hciconfig name
You also have to enable Low Energy advertising for your device to be found by others:
hciconfig leadv
You can configure your device to accept incoming connections like this (lm for link mode):
hciconfig lm MASTER,ACCEPT
This way the kernel will accept a connection, even if there are no listening sockets.
Considering you want to do actual communication, you would need to write a program, accepting the connection and sending/receiving data. Just putting your device in a mode where other devices can connect to it isn't really worth anything (because you can't communicate).
The basic principle is to open up an L2CAP socket, with the Channel ID of 4 (for Low Energy), then do standard bind/listen/accept. I suggest you look at the source code of Bluez and the examples.

Autoconfiguration on programmable Xbee modules

Non-programmable Xbee modules should be configured through a PC (with XCTU) or other devices like Arduino... but can the programmable xbee modules (like xbee-pro zb s2b) autoconfigure themselves, without being connected to another device like a PC or Arduino, by running code stored in their memory?
I mean, can they run orders like the ones you run through XCTU but programming them in the internal memory code? Like scan energy of every channel, select a channel, set a PAN ID, configure the different parameters of the device...
Thank you
Yes, the development kit includes an API for sending AT commands from the co-processor to the radio on those boards.
There's also a passthrough mode that relays the host computer serial port through to the radio processor, which can help with initial setup/configuration of the modules like you might do during manufacturing.
To answer your question:
I mean, can they run orders like the ones you run through XCTU but programming them in the internal memory code?
No. You can not program a sequence of orders/commands into the internal memory of the device. To do anything meaningful the device needs to be "driven" from a host PC or MCU that can send the AT Commands.
If you want 1 device solution that does not require a Host MCU then you will need to use a ZigBee SoC (System on Chip), such as the CC2538 - http://www.ti.com/product/cc2538 running a ZgBee SDK (Software Development Kit) - http://www.ti.com/tool/z-stack (ZStack-Home). However this will require you to develop the ZigBee application SW.
Regards,
TC.

How to implement Serial Port Profile Link Command used in ConnectBlue Bluetooth Module?

I am trying to implement Bluetooth using "connect-blue-oem-spa-331" module using UART protocol and using MSP430 as base controller. I'm using Embedded C as a language of programming.
Everything just works fine until I reach to Serial Port Link Command "AT*ADCP". Every time I get response as ERROR. I have tried with both options by keeping ECHO ENABLED and ECHO DISABLED.
p_cmd = "AT*ADCP=XXXXXXXXXXXX,0,0,0\r";
this is my command. 'X' represents the Bluetooth confirm device address which I confirm when I execute DEVICE_INQUIRY command.
The module through which I am executing all these commands is always MASTER and will initiate pairing and communication process. As a safety I have kept it non-discoverable.
How can I implement the Serial Port Profile Link command without getting error when I confirm the bluetooth device using DEVICE_INQUIRY command.
I have been working with blue tooth for last 4 months. I had faced above issue in early days. And after running through documentation available for product I solved the issue. I thought to reply this question which I've asked.
I was using Connect Blue OEM-SPA-331i classic Bluetooth module in my project, and was using Serial Port Profile to implement Bluetooth commands.
When I inquire devices I get the list of Bluetooth Devices available and discoverable in the vicinity(mine was CLASS-I Device); and lists them as (48 bit MAC Address,Class of Device) i.e. ( 001234ab987f,786545) of the discovered Bluetooth Module.
When I'm trying to establish Serial Port Profile Link, it was required that I must write address of peer device to be connected over Serial Port Profile in Serial Port Adapter. The order of the commands should be
Inquire discoverable devices
Write the desired peer device address to Serial Port Adapter, remember it in power cycles.
Establish Profile Link.
This way I resolved my issue of link not getting established.

Connect Arduino to the Internet without the shield

I am doing some projects with Arduino at the moment, and I was wondering if it is possible to make HTTP requests without the Internet shield.
The idea was to make a program which does HTTP requests and sends the response to the Arduino over the serial port.
I did some search online, but I could not find a way how to send the response to the Arduino board.
Yep, I've done this. I had a remote temperature logger built with an Arduino. Then I used the USB cable to connect the Arduino to a laptop. The laptop had a WiFi connection to my network and could get out to the Internet if it wanted to, but I actually just connected to my desktop.
I didn't do anything special on the Arduino other than writing to/reading from the Serial port. I had a tiny Python program on the laptop acting as a gateway to the network (read from Serial, write to port and vice versa) and another tiny Python program on my desktop to read from port and write to disk.
it is possible also to use pyfirmata in a python web server like flask under linux to control your arduino via web interface.your arduino will commnunicate with your web server via firmata protocol

Resources