February 6, 2016

A project log for AquaPic - Aquarium Controller

Reef tank controller used to monitor various parameters such as temp and pH, and also control equipment such as pump and lights.

Skyler BrandtSkyler Brandt 02/06/2016 at 10:310 Comments

The following update post was the ramblings of an extremely frustrated, under-equipped, and marginally trained hobbyist, and probably completely off base. Please disregard anything I said. I'm fairly certain I missed diagnosed the issue and am hopefully headed in the right direction now. Those words haven't been muttered before. Update to follow soon.

TLDR - If you want to use a USB-WiFi dongle and a USB-RS485 dongle at the same time on the RPi, it best to rethink the plan. Multiplexing those will only lead to issues...maybe.

Now that the backlight control is finished for the LCD, I was ready to do some final bench testing of the controller. I wanted to let it run for a while, maybe a week, to see what issues I ran into before I let this thing control my fish and coral's livelihood. The test was successful for about 50ms before everything went awry. I kept having communication faults between the RPi and the slave modules, but it wasn't consistent. For the first minute or so I would have a few intermittent timeouts or crc errors. Then it would magically fix itself and everything would run smoothly for about 10 minutes. After a good while without any faults, around the 12 minute mark, the communication would go off the rails again and start throwing errors again. Only now it wasn't as sparsely intermittent, but every 2nd or 3rd message would fault. Needless to say, I was lost on the issue. My first thought was that the received event in the serial class was the issue, because its already a hacky mess of a workaround to begin with. I changed some code around and tried again without the received event but the issue seemed to be worse. I fiddled with small changes here and there, but still had communication faults. I then decided that debugging on the RPi was only a handicap, so I swapped to my Windows PC and BAM! no issues. I removed as much of the hacky workarounds that I could and tried again on the RPi but it still didn't consistently work. I should now mention that this wasn't the only issue I was having. I was also having difficulty SSHing into the RPi. It would either timeout and not connect or take forever. It was at this point that I realized that if I was doing a lot on the SSH connection, the controller would start presenting comm faults. Finally, I concluded that the most likely candidate to cause me intermittent issues was the USB multiplexer try to handle the bandwidth of the WiFi, RS485, and touchscreen. It just can't keep up with all that traffic. There are other obvious difference between that RPi and my PC, Linux vs. Windows, .NET vs. Mono, but I don't think any other those are cause this issue. My way out of this is going to be the UART pins on the GPIO header. Fingers crossed I'm chasing the right lead, and its not something else.