Hi All
I am relatively new to the Raspberry PI and have not used Cayenne before, however:
I am working on building an irrigation controller. So far I have built it up using an inherited raspberry PI 2B and a Denkovi 8 channel USB relay board. Denkovi supply their own GUI control software which works on Raspian. I have had all this working quite nicely.
However I have recently stumbled upon Cayenne and it is a no-brainer to try set it up for the ultimate remote control. As of yet, I haven’t found any guidelines on how I should go about controlling the USB board through the Raspberry PI, as this of course does not use the GPIO pins (in hindsight would have been a cleaner solution with using Cayenne). Is anyone able to give me some pointers on where to start?
As an aside, there is also command line software which can run basic control of the relays. As one method I assume Cayanne can execute command line script on the RPI?
Thanks all for you help.
So far I have managed to connect the rpi as a BYOT device and get it to toggle a basic print command as per the posted instructions. All good there - I can see how this will work with the board.
Before trying to stitch the whole thing together I have then attempted to control the board with a basic python script to turn one relay on only to make sure this works ok. This is where I am coming unstuck. The script runs, but does nothing, throws no errors or anything. Note I have to run it as sudo otherwise it throws a permission denied error.
As confirmation, upon entering:
dmesg | grep tty
I get:
[ 0.000000] Kernel command line: bcm2708_fb.fbwidth=640 bcm2708_fb.fbheight=480 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=tty1 console=ttyAMA0,115200 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash plymouth.ignore-serial-consoles
[ 0.001330] console [tty1] enabled
[ 1.003745] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2
[ 1.948461] console [ttyAMA0] enabled
[ 6.638645] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
The script i have written to turn on the relay is:
import serial
port = serial.Serial(
"/dev/ttyAMA0",
baudrate=115200,
timeout=3.0)
port.write("04+//")
print('script complete')
This should be turning on relay 4, however nothing happens.
Can anyone point out my error here?
Many thanks for assistance to date.
Usually, under Linux FTDI works without having to install anything.
According your dmesg | grep tty result: [ 6.638645] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
So, OK for the raspberry pi
I use FTDI out of the box many times.
Cheers