Hi,
Im looking for python code to connect to cr1000.
Ive seen the pycampbellcr1000 python code but that doesnt work with latest cr1000 os.
With kind regards.
There isn't any Python code that is "officially" supported by Campbell Scientific. There is an alternative method for interacting with the logger and can be driven by Python. Each logger, if the HTTP interface is enabled and the CR1000 has an Ethernet interface that can be reached by the PC or server running Python, has the ability to be driven by the Datalogger Web API (HTTP GET) calls.
Take a look at https://help.campbellsci.com/crbasic/cr1000x/#Info/webserverapicommands1.htm#kanchor360.
The CR1000X and CR1000 have very simular Web API command sets.
I finally have found the solution.
The error occurs because sys.stdout is not a binary stream but rather a text stream.
To fix:
Open the compact. py file located in c: \program files\python311\lib\site-packages\pycampbellcr1000.
Find the line that reads stdout = sys.stdout. buffer and replace it with stdout = getattr(sys.stdout, 'buffer', sys.stdout)
Save the file and re run the code.
@makada
I'm also willing to fetch the mateorological data using raspberry pi can you provide python code for this?
I'm getting error with my code.
How to access cr1000 datalogger through Arduino mega or any microcontroller??
And How I can give password to the datalogger so that it identify and accept it and begins communication to fetch the
mateorological data from Campbell scientific cr1000??
Arduino mega and many other microcontrollers support HTTP GET. Passwords are described under Command Syntax, but you can set read-only anonymous access too. Fetching data is described under Data Query section.
https://help.campbellsci.com/crbasic/cr1000x/#Info/webserverapicommands1.htm#kanchor360
https://help.campbellsci.com/crbasic/cr1000x/Content/Info/dataqueryexamples1.htm
This post is under review.
@Haidar: can you show your current python script so I have a look.