piACC PiZero Wireless Relay

Forums:


The headless relay node is using a Raspberry Pi zero with a stand install of Jessie-light.
It is a little more complicated to configure because you have to set everything up using SSH to connect and scp to transfer the required files. This will however reduce power consumption. I was not able to find my Samsung using the discovery below, but turned off connectivity on the phone and turned it back on. The phone prompted me to connect and listed available devices.
As soon as I typed "pair XX:XX:XX:XX:XX:XX" (replace X's with the mac address of the phone) on the relay pi they connected and both sides prompted me for the pairing. I hit enter on both sides and at that point the two devices were paired.

Once I had it paired I was able to start up piacc1 and connect the phone to the relay pi using blueterm.
Entering in "a" I received the all lamps on message and heard each of the four relays click on.
Entering in "x" I heard all four relays click off.
Entering in "q" I received the disconnect message and the relay pi went back into waiting for a client.
All is good. Source:
https://www.cnet.com/how-to/how-to-setup-bluetooth-on-a-raspberry-pi-3/

Type sudo bluetoothctl then press enter (input the administrator password if requested)
Next, enter agent on and press enter.
Then type default-agent and press enter.
Type scan on and press enter.

The unique addresses of all the devices around the Raspberry Pi will appear and look something like an alphanumeric XX:XX:XX:XX:XX:XX. (MAC address)

If you make the device you want to pair discoverable (or put it into pairing mode),
the device nickname may appear to the right of the address.
If not, you will have to do a little trial and error or waiting to find the correct device.

To pair the device, type pair [device address].
The command will look something like:
pair XX:XX:XX:XX:XX:XX

Pi Zero Wireless Relay Component

First I connected the relay board to the pi zero.

Raspberry Pi Zero WH (with headers)

Being a wimp, I purchased the pi zero that already had the GPIO pins soldered.
I loaded the standard jessie-lite image.
After some struggling, I realized that the easiest way to set these up is to run
sudo raspi-confi
This allows you to: set passwrod, set up wifi, SSH, all of the language settings, boot into terminal with pi account and expand the file system.
All are basically required for a clean boot.
I then ran all of the settings from the "relay" article which includes installing python bluetooth, etc.
This included using scp to transfer over the piaccbt.py file and the zipped relay directory.
I placed them all under the pi/bin directory.
You should also run all of the apt- update options.
At this point, communications were working, the piacc.py programming was waiting for connections.
Next step is to automate all of this and create the image.
In theory, the only thing you should need to do is to add the mac address of the devices you want to be able to connect to the relay.
Become a Patron!This section is for patrons only. Become a patron to get a preview.
abitowhit's picture

So troubleshooting the python client but have it all fixed.
Turns out true is not the same as True.. haha.
Was working with cell but not my test pi.
Turns out when I added the mac of the test pi, I inadvertently typed true on the function return., It was choking at an unnamed global variable.
As soon as I changed it all was well..
hahaha.. proves that case does matter and one of those little gotchas betwixed c# and python.
Client is now working as expected, though I do need to build a cleaner way to add macs over entering them into the script.
I will probably pull from a config file