Prime Pump from Command Line

67 views
Skip to first unread message

Maxwell S Raderstorf

unread,
Mar 8, 2017, 5:05:52 PM3/8/17
to Mixture Controlled Turbidostat
I am working from a Raspberry Pi 3 and consequentially using putty or Arduino is a chore. Is it possible to prime the pump and communicate the necessary commands directly to the main board from the command line of the Pi? If so, how?

Specifically these steps
Message has been deleted

Chris Takahashi

unread,
Mar 8, 2017, 7:53:50 PM3/8/17
to Mixture Controlled Turbidostat
Hi Maxwell,
You can use a program like minicom or screen (baud rate is 19200 1n8). Just make sure you know how to quit the program before you start as they both work kinda weird ;)

Chris

Markos

unread,
Mar 9, 2017, 7:03:43 AM3/9/17
to mixture-control...@googlegroups.com
Hi Maxwell,

I have used the Tcl / Tk language to do automation.

And in the case for communication through the terminal I use only Tcl commands.


To install Tcl/Tk:

root@raspberrypi:~# apt-get install tcl8.5 tcl8.5-dev tcl8.5-doc
root@raspberrypi:~# apt-get install tk8.5 tk8.5-dev tk8.5-doc

Open the interpreter in terminal:

$ tclsh
%

command to open file id for serial port (/dev/ttyUSB0 or /dev/ttyACM0):

set porta [ open /dev/ttyUSB0 r+]


configure communication parameter:

fconfigure $porta -mode 9600,n,8,1

send command [command_to_device]

puts $porta [command_to_device]

clean buffer:

flush $porta

close file id for serial port:

close $porta

Exit from interpreter:

exit

Info about Tcl/Tk
http://www.tcl.tk/doc/

A tutorial in Portuguese about controlling a pump:

http://www.c2o.pro.br/automacao/download/bombas.pdf

Best Regards,
Markos
--
You received this message because you are subscribed to the Google Groups "Mixture Controlled Turbidostat" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mixture-controlled-tu...@googlegroups.com.
To post to this group, send email to mixture-control...@googlegroups.com.
Visit this group at https://groups.google.com/group/mixture-controlled-turbidostat.
For more options, visit https://groups.google.com/d/optout.

Maxwell S Raderstorf

unread,
Mar 9, 2017, 1:27:58 PM3/9/17
to Mixture Controlled Turbidostat
I appreciate the quick responses guys. Both minicom and tcl seem to wrk but when i get to the point of actually sending a command (clo; for example) I consistently get some variation of command not recognized. Any ideas on why this would be?

Chris Takahashi

unread,
Mar 9, 2017, 3:42:50 PM3/9/17
to Mixture Controlled Turbidostat
From minicom you should start seeing the raw data (16 numbers separated by spaces).  From there, the commands should work.  If you don't see that then you'll need to check your serial settings.

Maxwell S Raderstorf

unread,
Mar 9, 2017, 6:16:36 PM3/9/17
to Mixture Controlled Turbidostat
I see the numbers, but cannot directly type commands. I have to use ctrl - A G and run a pre-made script and it interprets the script as a command but always returns "command not found" or something of the like. It is quite perplexing.

Chris Takahashi

unread,
Mar 9, 2017, 8:16:31 PM3/9/17
to Mixture Controlled Turbidostat
Ah i see.  You're asking minicom to interpret the commands, which is not the right thing.

you have two options once you see the raw data.
1) type the commands (correctly! back space won't work) with no feedback.  when you press keys the'll get sent but you wont see any thing, which is confusing and why I like to tell people to use the arduino serial monitor.
2) turn on local echo in minicom (using the '-E' flag)  Then you'll be able to see what you type, but it'll still output the data at the same time so the characters will still get intermixed.

Markos

unread,
Mar 10, 2017, 7:25:56 AM3/10/17
to mixture-control...@googlegroups.com
Hi Maxwell,

Let's do it step by step.

What is the structure of the command?

For example, some devices require that the command be followed by a "newline" character only, while others require "new line" and "
carriage
return"
.

For example the commands to be sent to Masterflex peristaltic pumps follow the structure:

<STX>[command]<CR>.


Should be preceded by the <STX> control character (Start of Text

Text) "02" (hexadecimal) and terminated by <CR> (Carriage
Return - line change) "0d" (hexadecimal) in the code
ASCII.

In Tcl these characters are sent respectively as "\x02" and "\x0d".

So sending a command with Tcl would be:

puts -nonewline $port "\x02[command]\x0d"

flush $ port


And do not forget to configure the communication parameters correctly: baud rate, data bits, parity and stop bits.

Does this help?

Best Regards,
Markos
--

Maxwell S Raderstorf

unread,
Mar 22, 2017, 11:39:32 AM3/22/17
to Mixture Controlled Turbidostat
Thank you for all the help guys. I have been using minicom but also figured out how to install PuTTY onto the Pi. I am at the point where it seems like the commands should be going to the turbi (I have been testing with the clo; command) but no response (either in action from the turbi or an error line in the terminal) comes through. In minicom or putty is there something more I have to do other than type the commands printed in the Setup portion of the turbidostat manual?


On Wednesday, March 8, 2017 at 5:05:52 PM UTC-5, Maxwell S Raderstorf wrote:

Chris Takahashi

unread,
Mar 22, 2017, 3:45:58 PM3/22/17
to Mixture Controlled Turbidostat
If the valves are already closed you'll see no effect by typing clo;.
The commands do not output any response, they're just silently accepted or rejected.  I'd do things differently today, but sadly I don't have time to reimplement anything.  

I'd recommend trynig sel0; followed by clo;
You should see/hear the solenoid pinch valve open and close (some times it needs a bit of tube in the NC part to get it to actuate).

Also the act of plugging/unplugging the serial port can send random data and put the board into a weird state.  When testing commands press the reset button on the mainboard first and wait for the first two lines of data to show up just be be sure it's in a known state.

Chris
Reply all
Reply to author
Forward
0 new messages