Welcome! Log In Create A New Profile

Advanced

BV4626 on linux, getting started

Posted by WilliamN 
BV4626 on linux, getting started
December 09, 2014 09:20AM
I found it awkward getting started with the BV4626 from the information available and offer the following suggestions.

In my simple case of only one ttyUSB it is simple to confirm what the device is known as by doing
ls /dev/ttyUSB* which will return the actual dev number, probably /dev/ttyUSB0. If the is more than one device listed then this simple guide is not for you.
Given the device number change its permissions from root only to all users. At the terminal do
sudo su
chmod a+rw /dev/ttyUSB0 or whatever your device is known as.

I have modified the simple clock.py example so that it runs in IDLE without requiring calling parameters.

The modified text is:-

#! /usr/bin/python
# An example of how to use the BV4626 with Python and the RPi
# To use type at the command prompt python clock.py

import sys
from time import sleep
import BV4626 # bv4626 class


# ******************************************************************************
# simple demonstration
# ******************************************************************************
def main():

# connect to serial port, this can be done in any manner but the
# connect in BV4626 is convenient
sp = BV4626.connect("/dev/ttyUSB0",115200) #make sure the /dev/ttyUSB is correct for you
cl = BV4626.BV4626(sp)
print "Device id {}".format(cl.ID())
print "Firmware {}".format(cl.firmware())
print "Clicking relays"
for n in range(0,10):
print n
cl.relayA(1)
sleep(1)
cl.relayA(0)
sleep(1)

if __name__ == "__main__":
main()
************************************************************************************************************

If, as I do, al you want is to control the relays you may find this an adequate starting point
Re: BV4626 on linux, getting started
December 09, 2014 09:35AM
Thank you for the contribution,
there is very little information on using the device with USB on a Linux platform so this will help.
Jim
Sorry, only registered users may post in this forum.

Click here to login