Constant voltage/current mode
-
I'm considering the CheapStat as a means to apply a constant potential (300mV) for a small photoelectrochemical cell while recording the current (tens of microamps range). Is this possible with the CheapStat?
-
@bojan I'm pretty sure the Cheapstat hardware is capable of doing what you want and there is a constant voltage test in the cheapstat firmware. Unfortunately, I don't think that the firmware for the constant voltage test is finished. In particular I don't think the firmware sends any data back to the PC after running the constant voltage test. Also, I'm not 100% sure, but I think the java GUI would need to modified as well to accept data from the device when performing the constant voltage test.
I'm not the original author of the Cheapstat firmware. However I did at one point create a quick-and-dirty modification of the cheapstat firmware which adds a long duration constant voltage mode which might work for you. In this mode the cheapstat streams the data back to the PC as it is acquired. Note, the long duration constant voltage mode doesn't work with the standard GUI, instead it uses a command line based logger (a short python/pyserial program) to log the data as it comes in to the PC.
The source code for this hack can be found here https://bitbucket.org/iorodeo/cheapstat_hack/src
The project includes a makefile for building the firmware on linux.
The added/modified function in the firmware which streams the data back to the PC is CONSTVOLT_long in firmware/cheapstat.c - starts at line 2583.
The python/pyserial based command line logger is found in the logger sub-directory.
-
The Cheapstat firmware http://web.chem.ucsb.edu/~kwp/cheapstat/ most certainly sends data ove the USB; it sends it as an 8-bit binary stream preceeded by the mode.
It will also send the configurations as mode/config stream as a reply to any incoming USB data.
-
@WizWom Yes it is true that the cheapstat returns data via usb for the other tests e.g. LSV. However, this is not the case for the constant voltage test which I was referring to in my comment.
In the firmware the function for the constant voltage test is CONSTVOLT_test in CheapStat_v2.c (starting at line 2543). I've attached the source code
nt16_t CONSTVOLT_test (char* name, int16_t voltage, int16_t time) { uint16_t elapsed; int16_t current_DAC; //check limits if(voltage<-1600 || voltage>1600 || time<0 || time>9999) { lcdClear(); lcdHome(); lcdPrintData("outside limits",14); return -1; } current_DAC = (int16_t) (round(voltage*(4096.0/3300))+2048); //init timer TIMER.CTRLA = TC_CLKSEL_DIV1024_gc; //change switches PORTE.OUTSET = PIN1_bm; //switch0 PORTE.OUTSET = PIN2_bm; //switch2 PORTE.OUTSET = PIN3_bm; //switch3 PORTE.OUTCLR = PIN0_bm; //switch1 //apply voltage while (DAC_Channel_DataEmpty(&DACB, CH0) == false) {} DAC_Channel_Write(&DACB,current_DAC,CH0); //start timer TIMER.CNT = 0; elapsed = 0; while(elapsed < time) { //wait for 1 sec while(TIMER.CNT<1953) {} //reset timer TIMER.CNT = 0; //increment elapsed elapsed++; } PORTE.OUTSET = PIN0_bm; //switch1 PORTE.OUTCLR = PIN1_bm; //switch0 PORTE.OUTCLR = PIN2_bm; //switch2 PORTE.OUTCLR = PIN3_bm; //switch3 current_DAC = 2048; while (DAC_Channel_DataEmpty(&DACB, CH0) == false) {} DAC_Channel_Write(&DACB,current_DAC,CH0); return elapsed; }
As you can see at no point in this function is any data sent to the host pc via the USART (using something like USART_PutCar).
For a comparison you could look at the LSV_test function (line 2360). In particular starting after the comment "//start output to USB" (line 2493) you will see the section where data is sent back to the host PC using the USART_PutChar function.
Note, I think it would pretty straight forward to modify the CONSTVOLT_test function so that it did send back data to the PC. Also, as another option, maybe it would be possible to mimic a constant voltage test by running one of the other tests with specific settings ?
-
@Will-Dickson you seem to be correct, although I can't fathom why you would run a test you can't get data from, that's not a test. It amounts to using the cheapstat as a voltage source.
-
the explanations are detailed thanks for all that support, I learn from the problems of others