SmartKegerator v2 Installation Guide

This project has been heavily modified to take advantage of the raspberry pi 2’s additional horsepower. If you are looking for the raspberry pi v1 code, look around version 62 in the repository. Version 70 and on are unlikely to work on the original pi, although I have not tried.

[Updated 10/4/2016: These instructions have been updated and now work with a clean raspbianPIXEL image]

Installation:

Install a new copy of raspbian onto an sd card.

On your first boot, configure these:
Expand Filesystem
Boot to Desktop
Enable Camera
Configure keyboard (if not in UK) and timezone
Finish > Reboot

1) Update raspbian

sudo apt-get update
sudo apt-get upgrade
sudo rpi-update

2) Install requisites

sudo apt-get install qtcreator cmake libopencv-dev mplayer subversion qt4-dev-tools libqt4-dev libqt4-dev-bin qt4-qmake

3) Configure QtCreator

Launch QtCreator from start menu > Programming > QT Creator

Once in QT Creator:
Tools > Options > Build & Run > Qt Versions > Add > navigate to or paste: /usr/bin/qmake-qt4
Tools > Options > Build & Run > Compilers > Add > pick GCC
Then set compiler path : /usr/bin/arm-linux-gnueabihf-gcc-4.9
Click OK

Qt Creator seems to think that we are going to deploy on a remote target, to fix this :
Help > About Plugins
Uncheck Device Support > Remote Linux
Click Close and reopen Qt Creator

Tools > Options > Build & Run > Kits > Desktop-Qt4 4.8.6 (qt4)
Compiler: GCC
Debugger : /usr/bin/gdb

4) Compile facial recognition libraries

cd ~
git clone https://github.com/bytefish/libfacerec
cd libfacerec
sudo cmake .
sudo make

5) Compile QWT

cd ~
mkdir qwt
cd qwt
svn co svn://svn.code.sf.net/p/qwt/code/branches/qwt-6.1 ./
qmake qwt.pro
sudo make
sudo make install
cd lib/
sudo cp * /usr/lib/

6) Compile WiringPi

cd ~
git clone git://git.drogon.net/wiringPi
cd wiringPi/
./build

7) Get SmartKegerator source

cd ~
mkdir qt
cd qt/
mkdir SmartKegerator
cd SmartKegerator/
svn co https://subversion.assembla.com/svn/smartkegerator/trunk ./

8) Edit config files

sudo nano ~/qt/SmartKegerator/config.txt

Make sure all of the paths are correct for your system. If you’re using a fresh copy of raspbian and followed each step here, you shouldn’t need to edit anything.

9) Run it!

Open QTCreator and File > Open Project > /home/pi/qt/SmartKegerator/SmartKegerator.pro

Click Yes when it asks about environment settings.

Click the green arrow on the bottom-left to start building. The first build will take a while. If everything worked you should see the application open! If you get errors, try google or come back here and post a comment.

9) Disable the screen saver

sudo nano /etc/lightdm/lightdm.conf

scroll down until you see

[SeatDefaults]
#xserver-command=X

Remove the starting ‘#’ from ‘#xserver-command=X” and add ” -s 0 -dpms” to the end so you have:

[SeatDefaults]
xserver-command=X -s 0 -dpms

ctrl-x, y, enter to save

To use the Mimo-720S

See this post about configuring the touchscreen and kernel

Advertisements

90 responses to “SmartKegerator v2 Installation Guide

  1. in part 4 ,compile qwt, you have a command for svn command without mentioning installing subversioning (sudo apt-get install subversion). If a user does not have subversion installed, they will get an error “-bash: svn: command not found”. just an FYI.

  2. In Step 8, the path for running the project is missing /qt/ ? /home/pi/SmartKegerator/SmartKegerator.pro should be /home/pi/qt/SmartKegerator/SmartKegerator.pro ?

  3. sorry to bring up one of your older projects, but I’m having issues with the mimo screen (720-s) on the newer kernels (4.1.6). The monitor does work on 3.18, but when I ran a simple apt-get update, the monitor runs through the color checks (White, green, red, blue, black and repeat). Anyone else having this same issue or am I just not enabling a feature correctly?

      • So I think I’m to my last issue…….for now 🙂

        I have modified your source code to include a 3rd tap/keg within the system. I’m able to build the application and run it within the IDE. From here, I’m not sure what is needed with QT creator to be able to deploy the code so I can set the application to start at startup.

        Does anyone know how to set QT Creator to deploy the application so I do not need to build/run within the QT creator?

    • Yay! I am able to run the built application without QTCreator by finding the output folder, and running the executable inside. Eg, for me, when I compile the SmartKegerator, as a sibling to the SmartKegerator folder I get SmartKegerator_build_blahblah_Release (or _Debug, if you were doing a debug build) and then inside that folder should be a file called SmartKegerator. Double click that and pick Execute and it should launch the application standalone. Let me know if that was confusing or something doesn’t work!

      • I’ve try to run the executable on its own, but the application never starts. I do get the window about “execute, execute in terminal, cancel”.

        I’m not just trying to run “sudo make” withing the source code. Crossing my fingers.

        And FYI, the official Raspberry Pi TouchScreen works great with the software. I ended up just swapping out the Mimo monitor for the new official setup.

      • How I’ve always gotten it to work was building in QTCreator via the green arrow, then going to the folder of the build you just made (debug or release) and running the SmartKegerator standalone. Have you tried starting it from the shell? Are you getting any errors?
        On the new display, that’s awesome! I had just picked one up as well and am using it for another camera project based on this code, and agree it works great! The touchscreen is MUCH more responsive, and the refresh rate seems much higher, especially when I had to use the USB 1.1 speed trick to get the mimo’s touchscreen to work.

    • Hmm, some things to try:
      Wipe that build folder, and build again. Once it compiles and the folder exists again, try opening a shell to that folder and running the app through the shell. You might see some errors printed out if there’s an issue. If that still doesn’t work, try removing code from the project (or just putting early return;s in the initialization code) or using lots of log messages to see where the code starts failing.

      • as an update…..
        If I try to just double click on the “SmartKegerator” icon within the release folder, I do get the prompt to “execute, execute in terminal or cancel”. If I execute, nothing happens (CPU does not jump above 10%). If I execute in terminal, I get a flash from a box about the same size as a terminal window, but I can not see anything within the box before the box disappears. If I try to open a new terminal window and try to start the SmarkKegerator executable, my error message is “-bash: SmartKegerator: Command not found”, which is probably due to me not really knowing what I am doing.

        With the same source code, I can open the project in QT, build and run the project with no issues. I have tried to delete the Release and/or Debug folders to see if that would resolve this issue with no luck.

        I have uploaded my adjusted code from your source to github if you would like to see it, since it also has some changes for 3 taps instead of 2. I will not publish the code unless I have your permission.

      • Aha! It worked no problem on my main dev image, so I booted the image that I created duplicating my installation steps, and viola, the app wouldn’t launch! Running from a terminal lent the error: libqwt.so.6 not found. So I’d imagine this is what you’re hitting as well. The fix is simply moving the qwt shared objects into the shared lib folder, which is where the application is looking.

        cd ~/qwt/lib/
        sudo cp * /usr/lib/

        That’s it!

        Now you can run the app by double clicking or with bash by navigating to your build folder and executing:

        cd ~/qt/SmartKegerator-build-desktop-Qt_4_8_2__System__Debug/
        ./SmartKegerator

        ‘~’ is a shortcut for your home dir, /home/pi/
        ‘./’ tells bash to look in the current folder

      • That Worked!!!!

        Thank you. All that I had to do after moving the folder was to add the Executable to AutoStart and change the config setting for full screen.

        Now it’s time for a beer….or three 🙂

        Thank you for everything.

      • Nice! I’m glad it’s all running now! Could you share a link to your github? I’m curious to browse, and if you put a link to my project I don’t have an issue with you publicly sharing it.

  4. Phil; thanks for the help so far… Im up and running but am having troubles with some beer logos loading. I am putting the images in the logo folder but some work, some dont. Any pointers?

    • Awesome! The logo code was hastily added so it’s certainly not perfect. Looking at the code, the LogoPath is set in Beer.cpp using:
      LogoPath = QString(Settings::GetString(“beerLogoPath”).c_str()).arg(Name.c_str()).toStdString();
      So if the beerLogoPath in your config.txt was /home/pi/qt/SmartKegerator/images/logos/%1.png and your beer name was “Bud Light” then it would look for the logo at /home/pi/qt/SmartKegerator/images/logos/Bud Light.png
      Hopefully that helped. Let me know if you’re still having issues!

  5. Phil and Namoh21, I’ve adapted the original source code and your modification to fit 5 taps, and have reconfigured the main window GUI. Unfortunately, I’m missing something, as the flow meters are not registering on any of the taps. And the settings for the 5 taps don’t get saved when I restart the program. I’ll keep plugging away at it, but if you have any suggestions, I’m all ears! (I’ll post the code when I resolve these two issues.)

  6. I’ve published my modifications for 5 taps on GitHub here: https://github.com/carloswlkr/SmartKegerator_5Taps

    The program is currently crashing as it starts to engage the facial recognition during a pour. If I point the camera towards the wall, the program does not engage facial detection, and proceeds to log the pour. Program is also a bit buggy on registering which tap is being poured. Three of the five sensors all register pours on the center tap. I’ll keep working on the code and publish any fixes. Any recommendations or comments are welcome!

    • Fixed the crashing… quite easy actually… I had eliminated the ‘unknown’ ‘-1’ user. once I added it back in, facial detection does not crash. Still working out a bug with 3 of the sensors registering flow on the same tap, but hope to have it resolved soon.

    • Hey Carlos, if you’re making code changes then I can’t really tell you why you are crashing. You’ll need to track your crash down using the debugger, breakpoints and logs.
      For the flow meters, the first thing to check is that the python script registers pulses. If you look in external/gpioWFI.py, that is the script that is actually checking for flow meter pulses, and the c++ is just waiting for output from that script. Make sure if you run the script by itself and tick your flow meters that the correct output is displayed

      • Thanks, Phil. I fixed the crashing… I had cleared out the user file and created my own users, but left out the ‘unknown’ user with id=-1. Finally caught it, and it’s working now. Still working on the flow meters but will look into what you suggest and see if I can fix it tonight.

        Thanks again!

      • The kinks have been worked out, and the SmartKegerator for 5 taps is now working properly! Not sure how the facial recognition is supposed to work, but at least the facial detection, flow meters, and keg sides are all working properly. Code is up on GitHub for anyone that wants it. Just change the path name or update the config file to remove the ‘_5taps’. https://github.com/carloswlkr/SmartKegerator_5Taps
        Cheers!

  7. In Step 3:
    I do not get a /usr/bin/qmake-qt4 when I browse I get /usr/bin/qmake

    Also for:
    Then set compiler path : /usr/bin/arm-linux-gnueabihf-gcc-4.6
    I cannot find 4.6 but see a usr/bin/arm-linux-gnueabihf-gcc-4.9

    So then in step 5:
    qmake qwt.pro shows qmake: could not exec ‘/usr/lib/arm-linux-gnueabihf/qt4/bin/qmake’: No such file or directory

    • That flowmeter looks like it should operate the same as the ones I used. Just calibrate your TicksPerLiter in your config.txt file.

      Copied from another response above:
      The logo code was hastily added so it’s certainly not perfect. Looking at the code, the LogoPath is set in Beer.cpp using:
      LogoPath = QString(Settings::GetString(“beerLogoPath”).c_str()).arg(Name.c_str()).toStdString();
      So if the beerLogoPath in your config.txt was /home/pi/qt/SmartKegerator/images/logos/%1.png and your beer name was “Bud Light” then it would look for the logo at /home/pi/qt/SmartKegerator/images/logos/Bud Light.png
      Hopefully that helped. Let me know if you’re still having issues!

      • Thanks – I was just in the config file and missed that line.

        Where in your beer line did you place the flow meter? Middle, closer to faucet or closer to coupler? I am getting all foam on the line with the flow meter but if I switch the keg back to other line pours fine. I am running 10ft line with flow meter installed 3ft from the faucet

      • I have almost that exact setup in terms of distances, and have not had any issues with foam. My only guess is that those flow meters you linked to may have a smaller wheel internally, whipping the beer up more, but I have only ever tried the meters I have so I can’t compare

    • Hi Jeremy,
      The pi 3 should work great with this, allowing you to bump up resolution and framerate, but I have not personally tried. You shouldn’t need to modify anything, the pi3 should just run it faster.

  8. Phil – Great project and I got it running really nice now with longer lines and different flow meters with the correct fittings. One thing I still cannot figure out is on the pour screen it is showing a cost per pint of $2.45 no matter what versus showing the price from the main screen shows. Any ideas?

    • Very cool! What flow meters did you end up using? Did it seem like those meters you linked previously were the source of the foamy beer?
      I haven’t touched this code or project in several months, so I’m not 100%, but looking through the code it looks like that QLabel is called label_6, and isn’t referenced anywhere in the code.
      To fix, I would open the pouringwindow.ui, rename that field to something like pricePerLiterField, then in pouringwindow.cpp, inside void PouringWindow::onPourStarted(), around line 105, add something like:

      double pricePerLiter = FlowMeterManager::CurrentKeg->GetPrice(1);
      ui->pricePerLiterField->setText(QString(“$%1”).arg(QString::number(pricePerLiter, ‘f’, 2)));

  9. I must say you did an excellent job on coding this. I think it came out really nicely. I installed on a raspberry pi 3 I started to have large amounts of issues trying to get it to connect. I am not sure if it is due to the newer versions of everything. Two things that I did. One I followed the command that Randy said to follow this command
    sudo apt-get install qt4-dev-tools libqt4-dev libqt4-dev-bin qt4-qmak.

    Even with that command I could still not get it to compile. There is no longer a tab for chain tools at least from what I can find. You really need to configure the kits with the compiler 4.9. After a few hours I figured out that the best way to make this work is after you download all of the files from your code to make sure to delete the SmartKegerator.user file. After that it will ask you to verify your desktop settings and then it will actually build. I hope this helps out with anyone else you may run into this issue.

    I am very new to all of this stuff and getting very interested in these types of projects and starting to code a little more. I really am not familiar with any of this type of coding and was wondering how I would create something to automate this to startup when my raspberry pi boots? Would I create a bash file or a script?

    • My Pi 3 should arrive in a few days and I will give it a shot. I will also do a better job of tracking what I do on the QT Chains set-up.

      • Thanks guys! I have a pi3 coming as well, but probably won’t get to try this for a while. I will update the instructions once I do with your guy’s input!

      • Thanks for that Command it really did help I think. If you get yours let me know if you have any issues.

        I just got most of the parts like breadboard and flow meters and temp/ humidity sensor. I am unable to get the GPIO pins to work I think.

        I am getting the following error for temp.

        GPIO:Write 17 0
        GPIO:Write 17 1
        Turned on the dht!
        Restarted temp process! 1

        Im not sure what I have setup wrong but I followed config of what was setup on the breadboard configurations. I am using a vilros PI T shape 40 pin cobbler breakout to a breadboard and also using DHT22 Temp/Hum sensor. I do know that I had fried one and I know of this because on the Adafurit website from where you buy this sensor they have a wiring diagram of how to set it up and test through command line and it works I get the temp and Hum but when I try to set the wiring back to urs it will not work is it due to the fact that I am running pi 3 I dont think so or is it do to the fact that I am using Vilros Pi breakout?

        Any Suggestions would be great

      • Just want to say thanks notrubr I really appreciate all of you help. I am going to be trying to setup a new list of instructions very soon hopefully on how to install Phil’s setup on raspberry pi 3. I have one last quick question I am very new to all of this coding. Notrubr I was reading the comments and noticed you stated about creating your Pi to boot up into the program. How did you go about that would you mind to share? If not can you let me know how you did it and what you did to do it.

  10. Thanks everyone for the code and comments.It helped with a lot of the initial issues I had implementing this. I’m using a pi 3, the pi touchscreen, the pi camera V2 NoIR, and the flow sensors and DHT22 temp sensor that phil recommended. Just as a note, I too had to use the command:
    sudo apt-get install qt4-dev-tools libqt4-dev libqt4-dev-bin qt4-qmak

    I’ve got program running and everything is working for the most part but I can’t seem to get the temp sensor working. I get the same error that diomm had:

    GPIO:Write 4 0
    GPIO:Write 4 1
    Turned on the dht!
    Restarted temp process! 1

    I know that the sensor is working thanks to some basic scripts from adafruit, and I’ve tried changing the pins in the config file, but it doesn’t seem to make a difference. Right now I have it on pin 4. Any thoughts or suggestions would be much appreciated.

    The other issue I have is trying to link faces with users. When I first open the users window I get the following:

    QMetaObject::connectSlotsByName: No matching signal for on_startCameraButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_saveImageButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_startSearchButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_deleteImageButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_closeButton_clicked()

    Then when I select a user and click the train button, the camera will start and identify faces but none of the buttons work except the exit button. Again, any thoughts or suggestions would be much appreciated.

    • Hi Phil,

      Try running the dht script directly from the shell with the correct pins passed in and see what happens. Make sure you’re using the power output pin and signal in pins correctly. I power it from a GPIO because I found I had to reset it every so often to keep working.

      The missing signal warnings are correct, because I haven’t finished that part yet 🙂 The training is not really implemented in the current version. I do intend to come back and finish it up, but life is taking up too much time right now. You will just have to build that out yourself, or wait for me. If you do build it out, let me know because I’d love to share it and help!

      • Thanks! I got the temp/humidity sensor working. I had to remove the 22 from the end of the tempSensorWFICommand in the config file. I haven’t had much luck with the facial recognition but if I get it to work I’ll let you know.

  11. Thanks everyone for the code and comments.It helped with a lot of the initial issues I had implementing this. I’m using a pi 3, the pi touchscreen, the pi camera V2 NoIR, and the flow sensors and DHT22 temp sensor that phil recommended. Just as a note, I too had to use the command:
    sudo apt-get install qt4-dev-tools libqt4-dev libqt4-dev-bin qt4-qmak

    I’ve got program running and everything is working for the most part but I can’t seem to get the temp sensor working. I get the same error that diomm had:

    GPIO:Write 4 0
    GPIO:Write 4 1
    Turned on the dht!
    Restarted temp process! 1

    I know that the sensor is working thanks to some basic scripts from adafruit, and I’ve tried changing the pins in the config file, but it doesn’t seem to make a difference. Right now I have it on pin 4. Any thoughts or suggestions would be much appreciated.

  12. Thanks everyone for the code and comments.It helped with a lot of the initial issues I had implementing this. I’m using a pi 3, the pi touchscreen, the pi camera V2 NoIR, and the flow sensors and DHT22 temp sensor that phil recommended. Just as a note, I too had to use the command:
    sudo apt-get install qt4-dev-tools libqt4-dev libqt4-dev-bin qt4-qmak

    I’ve got program running and everything is working for the most part but I can’t seem to get the temp/humidity sensor working. I get the same error that diomm had:

    GPIO:Write 4 0
    GPIO:Write 4 1
    Turned on the dht!
    Restarted temp process! 1

    I know that the sensor is working thanks to some basic scripts from adafruit, and I’ve tried changing the pins in the config file, but it doesn’t seem to make a difference. Right now I have it on pin 4. Any thoughts or suggestions would be much appreciated.

    The other issue I have is trying to link faces with users. When I first open the users window I get the following:

    QMetaObject::connectSlotsByName: No matching signal for on_startCameraButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_saveImageButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_startSearchButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_deleteImageButton_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_closeButton_clicked()

    Then when I select a user and click the train button, the camera will start and identify faces but none of the buttons work except the exit button. Again, any thoughts or suggestions would be much appreciated.

  13. Has anyone else had issues with false pours being detected? I get small 0.2-0.3 oz pours throughout the day. When I first installed the system I’d get 1 or 2 a day on the first keg bout I’d get one every 20-40 min on the second keg. I’ve since rewired everything and now I get the false pours equally between the two kegs every few hours. I tested the system multiple times throughout the project and only noticed the issue after the flow sensors got installed in the fridge. Any suggestions would be much appreciated.

    • Update: the false pours have settles back to the original occurrence rate of 1 or 2 a day on the first keg and 1 every 20-40 min on the second keg. I’ve disconnected the flow sensors and still have the issue.

    • Where are the sensors placed in the beer line, close to coupler, mid, or tap side? I get these also and have written them off as issues with the PSI and vibrations (cooling turning on/off) causing the liquid in the line to shift enough to cause a reading

      • They’re closer to the coupler side. Maybe 2′ or so from the couplers and 4′ from the taps. I was assuming it was an issue with the flow sensors too until I disconnected them and I was still getting the random pours. I get so many of these tiny pours that by the end of the day it’s registered about 12-16 oz poured. It’s too many to ignore unfortunately. At this point I’m exploring EMI as the potential issue but I’ve yet to confirm.

      • Just to see if I am following, you still had the beer line running trough the meter but the meter was not wired/hooked up to the Pi and as such no values were sent but the software still picked up a reading.

      • Correct. I set up the flow sensors and temp sensor with spade connectors so I could easily disconnect everything for maintenance. So I still have the wires that run into the fridge connected to the pi, but they aren’t connected to anything inside…and yes the software still detects pours.

    • I also got the the occasional false pour, which is what the code in FlowMeterManager::onFlowMeterData() lines 57 through 68 is trying to prevent.
      That threshold check worked for my setup, but maybe you could try raising the tickThreshold and see if that helps yours?

  14. Awesome Project!
    I’m running into an issue when I go to run.

    I had to use sudo apt-get install qt4-dev-tools libqt4-dev libqt4-dev-bin qt4-qmake to get qt-4 working and had to choose …gcc-4.9 under the compiler path as there wasn’t a 4.6 listed.

    When I go to run everything (hit green arrow) I get the error qwt_plot.h: No such file or directory. This is happening when #include is called on from widgeet/graph/qwtgraphframe.h.

    I checked and the 4 files that were in qwt/lib and they did get copied over to the /usr/lib folder.

    Any ideas as to what’s going on?

    Thanks!

    • Thanks Nathan!
      I don’t have any ideas off the top of my head. Things may have changed a bit since the last time I built this. I will try and build from scratch soon, but it might take me a while to get to it as I just bought a house. If you happen to find a solution let me know and I’ll add it to the steps above.

      Thanks!

    • I believe I may have found the issue with that. I was running into the exact same problem with the qwt_plot.h error. After searching online, I finally noticed in my SmartKegerator.pro file that it was calling to qwt-6.1.3-svn. After checking my file system, that directory didn’t exist. The directory I had was 6.1.4-svn. Once I changed that in my INCLUDEPATH and LIBS listings, I was able to successfully complete the build and launch the interface.

      It may not work exactly that same for you, but it my be worth a try.

    • In case you are still trying to get this working, either update svn or:

      Open SmartKegerator.pro, scroll to:

      /usr/local/qwt-6.1.3-svn/include

      change it to:

      /usr/local/qwt-6.1.3-svn/include \
      /home/pi/qwt/src

    • Alright, luckily it’s a quick fix!

      Either update svn or:

      Open SmartKegerator.pro, scroll to:

      /usr/local/qwt-6.1.3-svn/include

      change it to:

      /usr/local/qwt-6.1.3-svn/include \
      /home/pi/qwt/src

  15. Hey Phil,
    Sorry if this question is completely ridiculous, but I’m 100% green to RPi, Arduino, etc.

    I’m working on a DIY BrewPi build for temperature control of a keezer and want to incorporate your Smart Kegerator V2 for the dispensing portion. I have an RPi 3 that is connected to an Arduino Uno R3 with a shield. This is mostly for the BrewPi I/O portion simply for the easy of having all I/O go through the shield/Uno and then to the RPi via USB simply for the sake of consistency and to let the RPi focus on running smoothly and to let the Arduino do the legwork in terms of sensors.

    I’m wondering how hard it would be to modify your code so that instead of the flowmeters using the GPIO on the RPi, they are connected to the Uno and your program calls them from there instead. I’m hoping to add three load cells and a pressure sensor to the Uno as well, and would eventually like to incorporate those readouts into your GUI by adding my own code down the road.

    Is modifying the code to call the info from the Uno instead of the RPi a monumental task or an easy modification?

    • Hi Max,
      I’ve not personally used an arduino in conjunction with a pi before, but it should be totally doable.
      You’d need to write code on the arduino to read the sensors, and feed the data back to the pi in some string format of your choosing. Then in the smart kegerator code, you’d need to start listening to that serial connection, and parse the data format as it comes from the arduino, and update the UI accordingly. It’s not trivial, but really shouldn’t be too difficult once you are able to see the serial stream in the c++. Without knowing your skillset, it’s hard to gauge whether this is ‘monumental’ and while I wouldn’t call it easy, it shouldn’t take more than a weekend if you’ve got the time to commit!
      Good luck and let me know if you have any more questions and then let me know how it turns out!

      • Hi Phil,
        Thanks for your reply! My skillset is limited and I’m pretty new to be honest. I have done a little with Linux before, and am at least basically familiar with Python, MATLAB, Visual Basic, and a few others–enough so to be able to look at existing code and quickly figure out what it’s trying to do, but I’m a bit slower if I have to write from scratch. I don’t have any C* experience. I’m a mechanical engineer by profession, so my usage of code is a little different than a EE or somebody who does this type of project regularly, but my point is that I am at least familiar with the basics of programming in simple form.

        Anyway, I have the Arduino sketches and libraries I need in order to talk to the flowmeters, temperature sensors, pressure sensor, and load cells I will be using. I think I’m okay there from the Arduino end. I also already have the Arduino talking to the Pi over USB and was able to successfully send/receive information to/from the Arduino pins using pySerial. Basically, I was reading the data in Python by looping the command “ser.readline()” and it returns a string. I understand that I’ll need to take this input and feed it into your code somehow, which is the part that I’m not sure about.

        My question specifically for you, and maybe it is too complex to answer in a short comment, is in regard to how I modify your code to use data from the serial communication instead of the GPIO pins that your code uses and my hope is that I can modify a few small snippets to essentially “see” the Arduino pins as slave pins like they were a natural extension of the GPIO pins on the Pi. Is there a way to just change a few lines within your files so that instead of reading GPIO pins they read the serial data that is returned when I run the Python loop I mentioned? I briefly looked at the code you created and found what I think are the relevant files. For instance, gpioWFI.py seems to be defining GPIO pins for flowmeters. Can I simply change some of those lines to read the serial data and have all the other files reference and read correctly so long as I don’t change the variable names or references that your other files expect to see? I see there is a flowmetermanager.* file as well that may need some editing. I guess, I’m not sure what files I’d need to edit for this sort of thing, or even how to identify that.

        Sorry for the long message, and thanks in advance!

      • Hi Max,
        The code base should have examples of how to solve all the tricky bits, you will just need to reference how the DHT22 input is read, which is GPIO>Python>C++. From my understanding you want to get the data from Arduino>Python>C++, so you just need your python script to read the serial output from the arduino instead, and send output when an event happens. Then the c++ will need to read that ouput, parse the message, and fire the internal SmartKegerator function. The Temperature sensor using the DHT22 should do most of what you need, assuming you have a working python script reading from the Arduino.
        It’s not something that could be changed in a couple lines of code as you are fundamentally changing how that data is accessed, and you will have to write the code to glue all the pieces together yourself, for your specific implementation, but again it shouldn’t be too hard with all the work already in the project. You’ll just need to move stuff around, and copy the way the temp manager gets data to the flow meter manager and do the rest in your python scripts.

        Good luck!

  16. Phil I took some pictures of what happened. Is there an email address I could send them to? I was doing the apt-get upgrade and there was an issue with dpkg error while cleaning up. I restarted. I then tried to sudo apt-get qtcreator it then said dpkg was interrupted must manually configure. I did it went ok. Then sudo apt-get install qtcreator. I then got dpkg errors processing archive. It said files don’t exist
    : read only.

    • Hi Jeff,
      If you are getting dpkg errors, I worry something went wrong with some part of the installation.
      Would it be possible for you to start from a fresh copy of raspbian? If not, try reinstalling whatever package is giving you troubles like: sudo apt-get install –reinstall
      You can send screenshots to me at phil.harlow@gmail.com, although I may not be able to help beyond recommending to start over (I’m fairly inexperienced with linux)
      I wasn’t able to try this myself yet, but hopefully I can tonight and I’ll let you know if I hit any snags.

  17. Hi Phil, It seems like I have a defective sd card. I bought a new one and things went pretty well. Now I’m stuck again. It looks like you are using an ardiuno board for the camera? In Qtcreator log file … look like its looking at pin placements for the camera. I’m getting errors at those pin placements. I’m using the ribbon cable from camera to the Pi 3.

    I have the smart kegerator loaded. I can’t add a user or take a pic with it in smart kegerator but i can outside the program. You know raspistill -o image.jpg or something like that.

    • Hi Jeff,
      I do not use an arduino anywhere for this project. If you’re seeing logs about GPIO pins, that could possibly be the pins I use to turn on/off the LEDs I used for lights when the camera is on, or the pins that control the DHT22 (temp and humidity sensor) If you don’t need those parts, you can comment them out of the code and try again.

      As for the camera not working, are you only trying the user’s screen? This project was never fully completed, so parts like adding user photos and training are not done. If you have flow sensors hooked up, see if the camera works when blowing through a sensor to simulate a pour.

  18. Oh.. Ok . I”m sorry for this. I appreciate the patience. Thanks Phil for your work on this project. I am going to get my hand in there and see if I can customize it for my needs. very cool idea you got here

  19. I’ve got it installed but ok. My problem I have is after wiring my flow meter as you did it doesn’t snap a picture. Oh I was blowing into the flow meter at a constant rate like asked. Any ideas

    Thanks Phil

    • You can run sudo python /home/pi/qt/SmartKegerator/external/gpioWFI.py 23 24 (if you’ve connected the flow meters to pins 23 and 24) to see what the python program is spitting out, in case there are issues there. Otherwise you’ll need to make sure your flow meters are connected correctly and verify they are sending pulses with an arduino or oscilloscope

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s