I have been trying to following the documentation here:
I only have the following two lines in my code:
from potentiostat import Potentiostat
pstat = Potentiostat('/dev/cu.usbmodem3649831')
The first line runs fine but the second line throws the following error:
Traceback (most recent call last):
File "/Users/guest/Documents/Sublime/rodeostat.py", line 3, in <module>
pstat = Potentiostat('/dev/cu.usbmodem3649831')
File "/Users/guest/anaconda2/lib/python2.7/site-packages/potentiostat/potentiostat.py", line 111, in __ init __
self.hw_variant = self.get_hardware_variant()
File "/Users/guest/anaconda2/lib/python2.7/site-packages/potentiostat/potentiostat.py", line 120, in get_hardware_variant
msg_dict = self.send_cmd(cmd_dict)
File "/Users/guest/anaconda2/lib/python2.7/site-packages/potentiostat/potentiostat.py", line 407, in send_cmd
msg_dict = json.loads(msg_json.decode())
File "/Users/guest/anaconda2/lib/python2.7/json/__ init __.py", line 339, in loads
File "/Users/guest/anaconda2/lib/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/guest/anaconda2/lib/python2.7/json/decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
I have installed the iorodeo-potentiostat library using pip and am currently using Python 2.7.14 (although Python 3.5.4 gives me the same error as well). Is there something that I am missing?
This error means that you are not getting the correct response back from the Rodeostat. Did you at any time re-program the firmware on the Rodeostat? If so make sure that Tools -> optimize is set to "Fast" rather than "Faster" as there is an issue with the ArduinoJson library, used by the firmware, which causes a problem when optimize is set to "Faster".
That did the trick, thank you for the fast response!
Hi @austin ,
I'm having the same issue with two of my potentiostats from Windows. Where exactly is the Tools>Optimize you have mentioned?
When re-programming the firmware on the teensy3.2 with the Arduino IDE look in the "Tools" menu for the option called "Optimize" I've included a screenshot.
Thanks, @austin , I'll try that. Weirdly, I haven't done anything with the firmware. Any chances this could be due to a damaged cable between the my PC and the Tensy?
Maybe. The teensy on the Rodeostat should be pre-programmed. We pre-program the teensy3.2 and test the Rodeostat before sending them. However, programming they are easy to reprogram if there is an issue. The "ValueError: No JSON object could be decode" is generally an indication that there is an issue with the firmware - because it isn't send back the correct response.
Here are some instructions for re-programming the Rodeo firmware on the teensy 3.2
2.) Download the latest version of the iorodeo potentiostat repository https://bitbucket.org/iorodeo/potentiostat The firmware - which you will use to re-program the teensy 3.2 - is located in the "firmware" sub-directory.
3.) Open the Arduino IDE and go to "File -> Preferences" and set the "sketchbook" location to the "firmware" sub-directory mentioned in step 2. Then restart the Arduino IDE - this step is important. You are doing this so that the IDE can find the "firmware/libraries/potentiostat" library which is the library used by the Rodeostat. The restart in necessary as otherwise the IDE won't find the library.
4.) Re-open the Arduino IDE. Go to the "Tools" menu and set the following:
- Board = "Teensy 3.2/3.1"
- USB Type = "Serial"
- CPU Speed = "72MHz"
- Port = the USB/Serial port associated with the Teensy 3.2.
- Optimize = "Fast" (Note, the Faster setting won't work due to a bug in the ArduinoJson library).
Note, on linux the port might be something like /dev/ttyACM0 or /dev/ttyACM1, etc. On Windows it might be COM1, COM2, etc. If the "Port" entry in the menu is disabled then it is possible that the teensy 3.2 has been programmed with a USB Type of something other than "Serial". In this case you shouldn't need to set the port.
5.) In the Arduino IDE open the Rodeostat firmware "potentiostat.ino" file. This file can found in the "firmware/potentiostat" sub-directory of the potentiostat repository.
6.) In the Arduino IDE build the firmware by pressing the "Verify" button in the toolbar at the top of the IDE. The "Verify" button is the one with the checkmark. If all goes well there should be no errors.
7.) In the Arduino IDE upload the firmware to the teensy 3.2 by pressing the "Upload" button in the toolbar at the top of the IDE. The "Upload" button is the one with the right arrow. If all goes well there should be no errors.
At this point you should have the teensy 3.2 reprogrammed with the Rodeostat firmware.
Hi, @austin ,
I followed all your steps and it worked perfectly. Thanks a lot!