Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various tidyups and support for the BV4626 I/O board #20

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

coling
Copy link

@coling coling commented May 31, 2014

Hi,

I spoke with you a long time back (more than year I think) about supporting this little I/O board.

I've finally found some time to actually hack on it and have written a small interface driver for it. It's not feature complete and is currently output only, but I do intend to add support for reading input pins (I want to hook up a motion sensor) and the ADC (for a temperature sensor).

With the current code, I also hooked an output pin up to a small RF transmitter that allowed me to switch on/off some wireless sockets sold by Maplin. I've factored this into a helper class that should be usable by other interfaces (e.g. I know it can work on Arduino) too.

While trying to understand the code (my python isn't great), I did a few tidyups along the way that removed dead code.

I think this is OK to merge now, but if you'd rather wait until I finish the input/ADC code or have any other suggestions, that's all fine too!

Cheers!

Colin Guthrie added 18 commits June 1, 2014 00:48
The other values (xonxoff and dsrdtr) remain unused but I don't want to mess too much
with them.

THe serial.Serial device defaults to rtscts=False so this change should make no
difference, but some devices like the upcoming BV4626 need this set to True.
It seems that MODEM_PREFIX is not uses, so nuke it.
(just trying to tidy up code that confuses me while trying
to write a driver for the BV4626)
This removes the _processRegister() method that seems to have either
been deprecated or copy/pasted overzealously.

None of these methods were called.
When running tests on the BV4626 device, it appears not to initialise correctly the
second time it is opened. This is a result of not closing it cleanly when finished,
so ensure this is possible.

It may make sense to do this automatically on object destruction but I did not want
to disrupt other devices that I cannot test
Currently this only supports setting the two relay states but I will add support for
configuring and toggling the Digital IO pins and the DAC/ADC in future revisions.
The on/off was so far able to switch the relays on and off but now we can
configure which of the 8 general purpose I/O pins are outputs and switch
them on/off too.
For some unknown reason, reconnecting for each of the tests doesn't
work all that great. Reordering the tests seems to work around this
problem.
…r Maplin Wireless Sockets

These sockets plug inline into mains outlets and receive a wireless signal to
turn them on or off.

A trivial reciever module can plug almost directly into the output pins of
several receiver boards (e.g. the BV4626 or Ardino, RPi and no doubt others)
and via a simple signal control these sockets.

This code was partly borrowed from https://github.com/dmcg/raspberry-strogonanoff

The above page contains links to the following resources:

http://www.maplin.co.uk/remote-controlled-mains-sockets-5-pack-348217
http://proto-pic.co.uk/434mhz-rf-link-transmitter/
http://www.fanjita.org/serendipity/archives/53-Interfacing-with-radio-controlled-mains-sockets-part-2.html
This should avoid writing data to the device when we don't absolutely
need to.
This removes old, copy+pasted tests and adds a cleaner instantiation so the
options at initialisation do not need to be specified twice.

Also adds additional testing for the Maplin Wireless Sockets.
…output pins.

Otherwise this does not actually send any signal on the wire.
When testing I usually triggered a connection via some other output pin
flip, so there was generally a connection already.

However, if there were no other triggers to do the connection, it could
be the case that the connection is not alive.
This generally makes them more useful generally and thus can be used by other
interfaces more readily.
…ate file.

This code is theoretically usable from other interfaces with minimal effort, so split
it out to be nice to others who may want to use it.
@coling
Copy link
Author

coling commented Jun 1, 2014

Oops missed a small bug in the mock test. Seems pull requests automatically update with the branch tho' so the extra couple commits I pushed today should fix that up!

@zonyl
Copy link
Owner

zonyl commented Jul 16, 2014

Just starting to get back into things and ill be pulling this down and reviewing it shortly. Thanks for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants