Friday, June 12, 2020

How to Compile iSpindel with Arduino IDE


My next little electronics project is to build an iSpindel. This is an open source project for DIY people to build their own Tilt-like specific gravity monitor for beer brewing, so this combines two of my favorite hobbies, brewing and electronics. The basic idea is as the beer ferments the angle of the iSpindel device sinks to a lower angle, and then does some math to figure out the specific gravity. The idea isn't so much to have exact gravity readings, but to know when fermentation is done by seeing the gravity flat-line.

iSpindel is set up to compile on PlatformIO, but I don't want to have to install and learn how to use a new IDE, so I'm going to do it in Arduino IDE. I realize the project has firmware files that are already compiled and ready to upload, but I want to make a couple of small changes, so I want to be able to compile it myself. The license says it's okay for me to do that:

"This project is free to use. It's permitted to modify for personal use.
It's not permitted to distribute the modified project. Modification can be
distributed via the official iSpindel release only. It's not permitted to distribute
 in a commercial way without permission."

So I'll make my little changes, and I won't share them with anyone. Hmm.

Start at https://github.com/universam1/iSpindel
Download the project as a zip file.
Unzipped to ~/src/iSpindel-master

Go to ~/src/iSpindel-master/pio/src, rename iSpindel.cpp to iSpindel.ino

Open iSpindel.ino in Arduino IDE, it will asks to make a folder named iSpindel and move the ino file into it. Do it.

In the ~/src/iSpindel-master/pio/lib folder, package these as individual zip files:
DoubleResetDetector
Globals
MPUOffset
Sender
WiFiManagerKT
tinyexpr

Install these into Arduino IDE by going to Sketch, Include Library, Add .zip Library, select the zip files. You have to do this one file at a time, and the IDE doesn't remember where it was, so it's kind of a pain.

Attempting to compile at this point gives an error about missing PubSubClient.h, downloaded from
https://github.com/knolleary/pubsubclient/releases/tag/v2.8
Download the zip file, not the tar.gz
In Arduino IDE, go to Sketch, Include Library, Add .zip library, select the downloaded zip file.

Skip this step, see below.
Attempting to compile at this poing give an error about missing I2Cdev.h.
Go to https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/I2Cdev
Download I2Cdev.cpp and I2Cdev.h, make a zip file with these, then do the Include Library thing again for this zip file.
I downloaded them to ~/src/iSpindel-master/pio/lib/I2Cdev.

Now missing MPU6050.h:
Go to Sketch, Include Library, Library Manager, search for MPU6050, install the one from Electronic Cats, version 0.0.2.

Now a fatal error, OneWire.h not found, installed DS18B20_RT library version 0.1.6, from Library Manager, it installs OneWire version 2.3.5 as a dependency. This is for the temperature sensor.

Also, multiple libraries found for I2Cdev.h:
Multiple libraries were found for "I2Cdev.h"
 Used: ~/Arduino/libraries/I2Cdev
 Not used: ~/Arduino/libraries/MPU6050

I'm going to delete the Used one and use the Not used one. I just deleted the folder ~/Arduino/libraries/I2Cdev, recompiled, and that error went away. Just skip installing I2Cdev as I mentioned above and this won't be a problem.

Next, DallasTemperature.h not found. Go to Sketch, Include Library, Library Manager, search for Dallas Temperature, install version 3.8.0.

Next, RunningMedian.h not found. Go to Sketch, Include Library, Library Manager, search for RunningMedian, install version 0.2.0.

Next, ThingSpeak.h not found. Install version 1.5.0 from Library Manager.

Next, BlynkSimpleEsp8266.h. Install BlynkGSM_Manager version 1.0.9 from Library Manager. It wants to also install Blynk version 0.6.1 and TinyGSM version 0.10.5, install all.

Yay! It compiled! There is one warning:

WARNING: library MPU6050 claims to run on avr, samd architecture(s) and may be incompatible with your current board which runs on esp8266 architecture(s).


Update, June 14, 2020: It compiles. It uploads. It doesn't work. Well, it does, but it's impossible to get to the configuration. I spent the good part of a day trying to get it to work, but no luck. It hangs on fetching the stored json configuration from the file system, but of course, there is no stored json yet since I can't get to the configuration. Hacked around that, then the DoubleResetDetector doesn't work, it just doesn't detect. I'm going to start from scratch and write my own code, borrowing from the iSpindel code as needed. Reading through that code, I can see there is a lot of checking for this and that that really isn't necessary. I pretty much already know how to set up the wifi, read the temperature, and read the motion/gyro/accelerometer. What I don't have is the experience the iSpindel folks have to figure out the math to calculate specific gravity, so I'll be "borrowing" that code.



3 comments:

Dirk said...

Dale,

What happened to your BeerBouy project that you had on Source Forge? Did you move it somewhere?

Dirk

Dale Anson said...

I had to take BeerBouy down, Tilt claims patent infringement.

tontonCD said...

I found that the project needs to be configured from the Blynk App, https://blynk.io/.
With the Blynk example the module appears in my wifi hot spots (prefs application).
I agree with you, too much things in this project.