Month: March 2019

Using a chinese ModBus temperature sensor

I’m testing this modbus SHT20 temperature and humidity sensor: https://www.aliexpress.com/item/SHT20-Temperature-Humidity-Sensor-Industrial-Grade-High-Precision-Temperature-Humidity-Transmitter-Monitoring-Sensor-Modbus-RS48/32923628973.html

There is not much information about this device at Aliexpress. Fortunately searching for the string XY-MD01 that was in the board returned this Russian web site: http://www.bizkit.ru/2018/11/14/5789/

It give a little more detail about the device. Also I found other website that used a different temperature sensor, but the modbus address and protocol is almost the same: https://techsparx.com/energy-system/modbus/linux-modbus-usb-rs485.html

The sample application worked correctly. All I did was to change the modbus_get_response_timeout() to include “&old_response_to_sec, &old_response_to_usec” as it was in the comments and changed the temperature division to: “(tab_rp_bits[0] / 10.0)”.

After some tests I got mbpoll working to read data as well:

$ sudo mbpoll -a 1 -b 9600 -r 2 -t 3 -P none /dev/ttyUSB0

It is nice as the Internet save our soul! I hope this post eventually help other people as well.

How to make VirtualBox to recognized USB Devices

By default VirtualBox on Ubuntu will not detect the USB Device. In order to get it working you need to install the Oracle Extended Package and add add your user to vboxusers group.

You can do it running these two commands:

$ sudo apt install virtualbox-ext-pack
$ sudo usermod -a -G vboxusers $USER

After doing it, please restart your computer (just doing logoff worked for me).

ImageMagick not authorized error

I was getting this error:

$ convert -density 150×150 +antialias -negate FILE1.PDF F1.png
convert-im6.q16: not authorized FILE1.PDF’ @ error/constitute.c/ReadImage/412. convert-im6.q16: no images defined F1.png’ @ error/convert.c/ConvertImageCommand/3258.

I found the solution here: https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413

/etc/ImageMagick-6/policy.xml

policy domain=”coder” rights=”read|write” pattern=”PS”
policy domain=”coder” rights=”read|write” pattern=”EPI”
policy domain=”coder” rights=”read|write” pattern=”PDF”
policy domain=”coder” rights=”read|write” pattern=”XPS”