Open raffiniert opened 3 years ago
It should do, nothing in the documentation raises a red flag. RS485 is a half-duplex protocol so that won't cause you any issues.
I'm not sure if we have anyone else using that hat but if you do find it works well please let me know and I'll add it to the doco.
what a freakin' fast reply! Thanks so much! Will do, and will comment back, thanks again!
It worked fine for me :-) On both Rp0W, Rp3B, OrangePi. BTW: the uart_control tool can be very helpful ...
cool @M-VdM ! Thanks! What did you do with that uart-tool? Necessary to make it work? Did you change something in the configuration to make it work?
Hi @raffiniert - I have also used the waveshare with an RPi Zero W. I have documented my process so if you confirm what you have/haven't managed to do so far, I can send through some steps to you.
hey @Squazel , so far, I have... ordered and received the components :-) Nothing else. So knowing your steps would be awesome. Thanks in advance!
Sorry @raffiniert - I didn't get/see this message a few weeks back.
Here was my process - let me know if any questions.
I also got the following parts as I have mounted the RPi inside the TWC/HPWC unit. You can always get the unit running outside of the TWC unit off a standard USB power supply, so this would be something to come back to only if needed later.
Initialise the Raspberry Pi (sorry if these steps are more basic than you need - I just documented my whole process). I'm using Windows here, so if you're doing things on a Mac or Linux (or using a keyboard/screen connected directly to the RPi) then things will be different.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=AU
network={
ssid="NETWORK-NAME"
psk="NETWORK-PASSWORD"
}
pi
, password raspberry
), and update password to something secure using passwd
Configure the RS485 HAT:
sudo apt-get install -y wiringpi
gpio -v
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.60.tar.gz
tar zxvf bcm2835-1.60.tar.gz
cd bcm2835-1.60/
sudo ./configure
sudo make && sudo make check && sudo make install
sudo apt-get update
sudo apt-get install -y python3-pip
sudo pip3 install RPi.GPIO
sudo pip3 install smbus
sudo raspi-config
Under "3 Interface Options" > "P6 Serial Port" set "Login shell" to No and Hardware to Yes
Then Finish > Reboot: No/boot/config.txt
to ensure that enable_uart=1
is present at the end of this file
Can use tail /boot/config.txt
to do thisModify config.txt pas per page 10 of the manual, noting the variation for the newer board with the 12M crystal as documented in https://www.waveshare.com/wiki/RS485_CAN_HAT:
echo "dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=12000000,interrupt=25,spimaxfrequency=2000000" | sudo tee -a /boot/config.txt
sudo reboot
dmesg | grep -i '\(can\|spi\)'
Connect to TWC
Install TWCManager
I did have a bit of trial and error along the way, so hopefully this helps you shortcut some of that pain. Happy to help if you get stuck along the way or if any of this doesn't make sense.
Cheers Michael
how awesome is that, @Squazel ! Thank you so much! Hope will have time to dig into soon...
@Squazel your instructions on configuring the RS485-HAT worked like a charm, thank you so much! Now if only I would succeed in installing TWCManager itself :-/
https://github.com/ngardiner/TWCManager/issues/406
Btw., I just drafted a small case to 3d print for the Raspi and HAT, if sme. needs it, let me know!
Ok, I succeeded with the installation, but now I get this when trying to up docker:
ERROR: for twcmanager Cannot start service twcmanager: linux runtime spec devices: error gathering device information while adding custom device "/dev/ttyUSB0": no such file or directory ERROR: Encountered errors while bringing up the project.
Ok, I changed in docker-compose.yml
`devices:
Now I can, for the first time, start with sudo docker-compose -f docker-compose.yml up
However, I get no output to the console. No TWC connected so far, but just no output seems strange? Or doesn't this work when using docker?
Unfortunately I'm not yet using docker for mine (different issues and haven't had time to clear everything and start again) - but no reason that this shouldn't work, and I believe that you should get something to console if running in the foreground.
You could try running in the background (-d I think) and then checking logs with: docker logs docker_twcmanager_1
But that will probably be blank as well...
The only other difference I can see there is that your device is serial0, while mine is ttyS0. Not sure why that would be different if we have the same hardware, but doesn't sound like that's the main issue from the way you describe it.
Should it work with using that adapter on a Raspberry Pi Zero W?
https://www.waveshare.com/w/upload/2/29/RS485-CAN-HAT-user-manuakl-en.pdf
I just like that idea more than having something plugged in to USB which - in my case - would be out under a carport, living in Switzerland with -20 to +35deg C.
The adapter is "half duplex", if that makes the difference.