Have been meaning to get back to my Eve Alpha board for a while but haven’t had the time. Fortunately, today and tomorrow should let me make some progress. I’m specifically aiming to get the RFM12B module working since it’s the same as used on my Minion boards and even at the same frequency too (433MHz).
I’m hoping to port the relevant parts of Jean-Claude Wippler’s excellent jeelib library into a python module and base everything around that. It would seem to be a good place to start – I know it works, it’s well written so even I can understand it and I have the datasheet.
We need to use SPI to talk to the RFM12B. First job then, see if I can get a working SPI implementation setup in python. I tried a few options – my preference was to use wiringpi and the wiringpi-python bindings. Couldn’t get that to go. Tried spidev-py too and couldn’t get on with that either!
I’ve been following the development of the quick2wire library so decided to give that a go…
Ok, an LED is not an RFM12B transceiver but using an MCP23S17 SPI I/O expander to operate the LED with SPI from the Raspberry Pi gives me confidence that when the radio doesn’t work it’s because I’ve cocked something up rather than any hardware or software library issue!
Here’s the code, all simple stuff really:
#!/usr/bin/env python3 from quick2wire.spi import * import time mcp23s17 = SPIDevice(0, 0) # Sets IODIRA to 0x00 (all output on GPIOA) mcp23s17.transaction(writing_bytes(0x40, 0x00, 0x00)) # toggle LED on or off by writing to GPIOA while True: mcp23s17.transaction(writing_bytes(0x40, 0x12, 128)) time.sleep(1) mcp23s17.transaction(writing_bytes(0x40, 0x12, 0)) time.sleep(1)
Right, today an LED, tomorrow the