Is there anything I need to modify to run on an arduino nano? I have been able to get it to install but it says unable to retrieve version and won’t let me install hardware.
Did you flash the hex file from the web interface?
You’ll want the Arduino RevC hex file and try Atmega328 based as wel as Uno as protocol.
Some Arduino Nano clones are using the WCH 340 chip. The linux driver for that has a bug causing pyserial to re-open the port at the incorrect baud rate. It will manifest as serial line gibbersh after the serial port re-opens. Re-opening happens for instance just before programming and when restarting the brewpi script. This driver also cannot manage 115200 baud rate (atleast on my setup), which the Uno uses for programming, so select ATmega328 based.
If this is your problem, your options are to either wait until it’s propagated through linux updates to you (ch341: set tty baud speed according to tty struct link) or do as I did just now after having had found the elusive cause; add a temporary hack.
- Open /home/brewpi/BrewPiUtil.py in an editor
- Rename method SetupSerial to SetupSerialReal. It should read:
def setupSerialReal(config, baud_rate=57600, time_out=0.1):
- Add the following above:
def setupSerial(config, baud_rate=57600, time_out=0.1): """ HACK: replaced method due to ch341 driver bug used for some Arduino Nano clones http://www.spinics.net/lists/linux-usb/msg121599.html """ setupSerialReal(config, baud_rate=9600, time_out=0.1).close() return setupSerialReal(config, baud_rate, time_out)
I am confused on exactly how you put this code above in. it states to rename to “Real”, but then in the second part of the post, it doesn’t show that? This is what my file looks like:
def setupSerial(config, baud_rate=57600, time_out=0.1): ser = None port = config['port'] dumpSerial = config.get('dumpSerial, False)
So should it be formatted like follows?:
def setupSerial(config, baud_rate=57600, time_out=0.1): setupSerialReal(config, baud_rate=9600, time_out=0.1).close() return setupSerialReal(config, baud_rate, time_out) def setupSerialReal(config, baud_rate=57600, time_out=0.1): ser = None port = config['port'] dumpSerial = config.get('dumpSerial, False) etc.....
This is on the latest update.
Yes. That is how I worked around the problem with flashing and serial gibberish on the nano clone using WCH340 chip.
I had an annoying problem, occasionally the fridge would just click when turning on, sounding just like a compressor starter relay problem. It’s an old fridge I found on the street, so not so strange. It wasn’t the fridge however, it was the Nano resetting just after switching the compressor on. All clones had the same issue. Wiring the real Uno to my protoboard removed that problem. Eventually I tired of the problem with the nano when all I could think of left to try was either to modify the nano pcb or opto isolation between the SSR and nano.
The nano clones (and I’d imagine the original) are very sensitive. So, be aware that there might be other issues with using the nano clone apart from linux driver bugs.
The only problem I encountered was that I couldn’t initially flash them from the brewpi control panel. However, everything worked fine after I flashed them on my PC with XLoader and reconnected them to the raspberry.