Windows Brew Pi(Spark) Install Instructions

I know Elco said he does his development on a windows box, is there any chance you or someone else can give a installation guide on getting it up and running. Looks Like python “pip” doesn’t have a lot of the required python packages, and I’m not all the familiar with python. I’m trying to set up my windows box to host the site, but I’m struggling with the python part of the install.

IIS is easy, and it will run PHP no problem. I’m working with a IIS8 windows 2012 box if that helps any.

For development, I use WAMP (just install, place the brewpi-www files inside the WAMP www files.
The script directory can be anywhere on your PC. We default to a TCP socket on Windows.

Are you using python 2.7? I think the packages should all be available for Windows. Pip is installed with Python since version 2.7.9.

For developing Python, I use PyCharm. PyCharm has an integrated package manager. We have an open source license for the full version, available to developers on request.

@Elco Ok, so I have the web UI up and running in IIS8, changed all the directories security setting to allow the iis user permission to modify the folders that hold both the UI and Python code.

Now my issue is I can’t get the “brewpi.py” script to run…The spark is not recognized on my machine at all, although it does power up, but I can’t find the COM id for the port setting. I just keep getting the below error.

I’m trying to get this fully up and running on my windows box as thats where my DMZ is set up and my router forwards to. I have a pretty complex double NAT setup as I have VOIP for phone and a non static IP.

Also, how does the spark connect to the WIFI? It appears all the current documentation suggest it’s always connected to a PI via usb.

Python Version: 2.7.9
Arduino Version: 1.6.1
Windows Version: Windows Server 2012
Spark Device Info: USB\VID_1D50&PID_607D\6D7F1FA54852

ERROR:

C:\inetpub\wwwroot\brew-pi\www-brew\python-brew>python brewpi.py
Mar 21 2015 11:32:22   Error opening serial port. Trying alternative serial port
 /dev/ttyACM1.
(could not open port 'COM1': WindowsError(2, 'The system cannot find the file sp
ecified.'))
Mar 21 2015 11:32:22   Error opening alternative serial port. Script will exit.
Is your controller connected via USB?
(could not open port '/dev/ttyACM1': WindowsError(3, 'The system cannot find the
 path specified.'))

MY Config.cfg File: (I have tried multiple COM numbers and default ports!)

scriptPath = C:\inetpub\wwwroot\brew-pi\www-brew\python-brew
wwwPath = C:\inetpub\wwwroot\brew-pi\www-brew
port = COM1
arduinoHome = C:\Program Files (x86)\Arduino\
avrdudeHome = C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
avrsizeHome = C:\Program Files (x86)\Arduino\hardware\tools\avr\bin
avrConf = C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf

My Site Folder Structure: (iis site points to the www-brew folder)

OK, well for anyone else having this issue, you have to download and manually install the windows drivers for the spark core.

They can be downloaded via the spark DEV site: Connecting Your Core Over USB
~OR~
Via this link: SparkCore Windows Drivers

Once you manually update the drivers, you can then run your python scripts as in the documentation.

If you need help doing this, here a good step by step tutorial from the Spark Dev Community.

Some more notes for running on Windows:

I was getting “permission denied” errors when the script tried to access the uploaded hex files.
This is because c:/wamp/tmp did not exist, so the default Windows temp directory was used. The uploaded file inherited permissions from the temp directory and was not readable by a normal user account.
Creating the directory c:/wamp/tmp and giving normal users permission for that dir fixed the issue.

Also add the following lines to your <script dir>/settings/config.cfg (adapt for your system):

wwwPath = C:\wamp\www\brewpi
port = COM30

Path to arduino tools (only when using an Arduino, for the Spark this is not needed):

arduinoHome = c:/arduino-1.0.4/
avrdudeHome = c:/arduino-1.0.4/hardware/tools/avr/bin/
avrsizeHome = c:/arduino-1.0.4/hardware/tools/avr/bin/
avrConf = c:/arduino-1.0.4/hardware/tools/avr/etc/avrdude.conf

In finally, copy config_user.php.example to config_user.php and modify the script path:"

	$scriptPath = 'c:/repos/brewpi-script';

The script and web interface default to using a TCP socket on port 6332 to communicate when they detect that they are running on Windows.