Articles Hierarchy

Articles Home » RPI » RPI operates ARDUINO PID control

RPI operates ARDUINO PID control


you have a arduino but no raspberry PI, no problem,
RUN IT FROM PC instead of RASPBERRY PI
the trend i made already on a PC in python
( what formerly was installed for the PMS3 tool )
so now i try to make this tool also available for PC.
And i try it with the laptop without PYTHON, so here the full installation.
( even there is a windows 7 64bit version running following works: )

from https://www.python.org/downloads/ get
python 2.7.8 for windows
doubleclick python-2.7.8.msi
it not make a desktop icon, pls find START / all programs /Python 2.7/ IDLE / for start
from https://pypi.python.org/pypi/pyserial
get pyserial-2.7.win32.exe run

find file / open / Scripts :miniterm and start, give in COMxx for your connected arduino

in open PYTHON shell type
import _tkinter and get >>> now i know its included already

from http://sourceforge.net/projects/numpy/files/
get numpy-1.8.1-win32-superpack-python2.7.exe run

from http://matplotlib.org/downloads.html
get matplotlib-1.3.1.win32-py2.7.exe run

from http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib get
python-dateutil-2.2.win32-py2.7.exe run
pyparsing-2.0.2.win32-py2.7.exe run
six-1.7.3.win32-py2.7.exe run

now get the project:
from kll.engineering-news.org
get arduinostream4.zip (RPI version )

now, even our PYTHON for WINDOWS is ready,
some things have to be changed in the code:

i created a working directory for the ( copy of ) the 2 python files
and a C:/Temp/ directory ( instead of ramdisk )

arduinostream.py
RAMDISKpath = 'C:/temp/' # for WIN PC
#RAMDISKpath = '/run/shm/'

initfilepath= RAMDISKpath # for WIN PC
#initfilepath= '/home/pi/arduinoproject/'
and copy toarduino_init.csv also to that
( with content like RSP setpoint 50% :)
,1,PCT,,50.0,20.0,5,,


# sport = "/dev/ttyACM0"
sport = "COM14" # failed PORT already open

#ser.open() #not need, and error in win 7


arduinooperation.py
RAMDISKpath = 'C:/temp/' # for WIN PC
#RAMDISKpath = '/run/shm/'

GIF_filepath = 'X:/xxx'

for test ( if service not run ) copy
fromarduino.csv to C:/temp/ ( with content like :)
,2014,08,12,21,36,44,,1,PCT,46.48,50.00,0.00,5,

the service arduinostream.py you start after testing
with RUN ( command prompt window with all full path information or just with double click on the arduinostream.py file )
C:\Users\me: C:/xxx/python.exe E:/yyy/arduinostream.py
check in C:/Temp/ for the update of the files
to stop the service type CTRL C in the command prompt window

the operation can start from python command line or python IDLE interface


in the new version these variable adjust to the operating system, still you need to preset them.



in a later version i also needed python PIL ( for *.jpg..):
from Python Imaging Library 1.1.7 for Python 2.7
get PIL-1.1.7.win32-py2.7.exe run