using Raspberry Pi to control Arduino using pyFirmata
Setting up your Arduino for Firmata
Firmata control of the Arduino requires loading an Arduino with the
special Firmata sketch. You can download the Arduino software from the
Arduino website. After opening the Arduino IDE, follow these steps to
install Firmata on your Arduino:
Click File->Examples->Firmata->StandardFirmata
From the Tools->Board menu, select the type of Arduino you are using.
From the Tools->Serial Port menu, choose the USB port to which your Arduino is connected.
Click the upload button (it looks like a right arrow, just next to
the checkmark) and wait for your sketch to upload. A message in the
bottom black windowwill indicate success or failure
Once the Firmata sketch is loaded on your Arduino, you can test it out with the Firmata Test Program.
Controlling your Arduino from Python
Next, your Raspberry Pi must be setup with the python firmata libraries. Run the following commands:
Use a USB cable to connect the Arduino with the Raspberry Pi
(remember to use the big USB Standard A connector and not the smaller
Micro B power connector). You can now find the USB name of the Arduino
by running 'ls -lrt /dev/tty*'. On my Raspberry Pi, it was listed as
/dev/ttyUSB0. Remember this value for later.
Connecting to an Arduino
To control an Arduino from a Python script on your Raspberry Pi, you
must first import the Arduino and util classes from the pyfirmata
module. Then, create an object using the USB address you found in the
previous step
Question: adding 1/4 teaspoon of 10% phosphoric acid to 19 litres of water, what will be the pH? Let's go through the calculations step by step. Step 1. Convert mass ( or volume) of 10% phosphoric acid to mole per litre ( mol/L) The above calculation shows that 1/4 tsp of H3PO4 acid is 6.97e-5 mol/L Step 2. Input this value to BATE (or other app) to calculate pH The answer: pH = 4.16, ie too acidic !? If you use pipette instead of teaspoon, 1 drop = 0.05ml. So 1/4 TSP means roughly 25 drops If you actually aim for pH 5.6 (which is optimum pH for mashing), conc will be 2.51 e-6, or 1/100 tsp , 0.044 ml, roughly 1 drop Let's roll back a bit. From recipes of BarleyWine , summer rye , hefe Gordon Strong suggested to use 1/4 teaspoon of 10% phosphoric acid, which is targeting pH of 5.5..... Discussion on homebrewtalk forum. However using online BF water calc , Sparge pH would be 4.6. but he also added 1 tsp of CaCl2. 2H20. Mash pH change from 5.7 t...
留言
張貼留言