Previous posts for this project:
- [CaTS] ForgetMeNot - Index
- [CaTS] ForgetMeNot - Week 0: Project Description
- [CaTS] ForgetMeNot - Week 1: EnOceanPi and Sensors
- [CaTS] ForgetMeNot - Week 2: Elro CoCo and Pi Cam with OpenHAB
- [CaTS] ForgetMeNot - Week 3: Data persistence and charts with OpenHAB
- [CaTS] ForgetMeNot - Week 4: Arduino-OpenHAB communication
- [CaTS] ForgetMeNot - Week 5: Getting familiar with EAGLE
- [CaTS] ForgetMeNot - Week 6: Getting to know the TBS1052B-EDU oscilloscope
- [CaTS] ForgetMeNot - Week 7: First tests with RPiSoC
- [CaTS] ForgetMeNot - Week 7 (2): More testing with RPiSoC
- [CaTS] ForgetMeNot - Week 8: Water dispenser and temperature
- [CaTS] ForgetMeNot - Week 9: RFID Cat detection and identification
- [CaTS] ForgetMeNot - Week 10: Peltier cooling experiment
- [CaTS] ForgetMeNot - Week 11: Starting the build
- [CaTS] ForgetMeNot - Week 11 (2): Continuing the build
- [CaTS] ForgetMeNot - 3D Printing: EnOcean sensor bracket
- [CaTS] ForgetMeNot - 3D Printing: EnOcean rocker switch and magnet holder
- [CaTS] ForgetMeNot - 3D Printing: Food dispenser prototype
- [CaTS] ForgetMeNot - 3D Printing: Weighing scale
- [CaTS] ForgetMeNot - Security: Some basic tips
- [CaTS] ForgetMeNot - Minion: Dave, the gassy minion
- [CaTS] ForgetMeNot - Pi Camera: Wide Angle Lens
Introduction
The end of the Forget Me Not Design Challenge is nearing ... But not before some last minute surprises and hiccups ...
I've been installing the electronics in the build and combining all components that were developed over the course of the project.
At this stage, this was mostly an integration task where the interaction between the different components was tested.
There were some pending tasks, things missing or even not working ... Let's have a look at what happened.
Hiccups & Surprises
Solenoid Valve
One of the things I overlooked for the water dispenser, is that the DC-DC step up converter driving the solenoid valve is triggered by a LOW signal on the enable pin and disabled with a HIGH signal.
This means that, when using the RPiSoC directly, I would flood the kitchen in case of a reset of the RPiSoC, because the pins are LOW by default. And since the Pi takes longer to boot and restore the default HIGH, I'd have a big problem ... As time was short, I went for a quick solution where I made a NOT gate using a transistor.
Perhaps there were better ways to do this (reprogramming default pin state of RPiSoC ?), but as I said, time was short and I had other issues to resolve as well.
Food Dispenser
The food dispenser prototype I had built early on didn't seem to work properly after all. The cat food was jamming and wouldn't dispense reliably. I had to come up with another idea, and fast.
To prevent the food getting stuck and not dispensing, I thought something should move inside the food container.
This is the new mechanism I've come up with:
It's not so nice looking, but it does the trick, and now the mechanism works reliably.
The software part of driving a servo with the RPiSoC could be reused, it's just the dispensing mechanism itself that changed.
Weighing Scales
This one is more of a silly mistake during assembly ...
While integrating all the different components in the build, it seems I mounted my load cells upside down. The result ?
Pushing/putting weight on the load cells didn't do anything. I was getting crazy: was it the hardware, or the software ? Why wouldn't it work anymore ?
Then I noticed that pulling the scale up was creating a reading. That's when I realised my mistake and mounted them correctly.
Some Little Things
There were some tasks that still required some attention. Even if they are small, they need to be done.
Timezone
It's a small thing to be done, but relevant in order to be able to correlate things properly and easily.
Setting the timezone is very straightforward:
pi@webserver ~ $ sudo dpkg-reconfigure tzdata
This will launch a wizard, looking like this:
Afterwards, the changes are acknowledged:
Current default time zone: 'Europe/Brussels' Local time is now: Mon Oct 20 15:18:09 CEST 2014. Universal Time is now: Mon Oct 20 13:18:09 UTC 2014.
I did a small verification:
pi@webserver ~ $ date Mon Oct 20 15:18:20 CEST 2014 pi@webserver ~ $ cat /etc/timezone Europe/Brussels
Et voila, correct timezone configured!
Wifi
I've been developing the project using an ethernet connection to the Raspberry Pi. Since I started the build and mounted the Pi in the enclosure, I configured wifi for remote access.
By editing the interfaces file and adding the correct SSID and password, the Pi should be able to connect the the network.
pi@webserver ~ $ sudo nano /etc/network/interfaces auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid "<your_ssid>" wpa-psk "<your_password>"
OpenHAB Notifications
I didn't have any notifications set up in openHAB, so I decided to give that a quick go.
michaelwylie has done a great job describing this for Android users, I'll quickly describe it for iOS users
iOS notifications can be achieved using "Prowl".
Some things are required for Prowl notifications with openHAB:
- an API key
- updating openhab.cfg
- a notification rule in openHAB
- the prowl action jar in the addons folder
- a Prowl client on the iOS device
API Key
This step is easy.
Go to Prowl - iOS Push Notifications and register for a free account. You can then generate an API key to be used by your application.
openhab.cfg
There are three parameters that need to be set in the openhab.cfg file for Prowl to work.
- the API key which was generated earlier
- a default priority
- API URL
Don't forget to uncomment the lines by removing the "#" at the start of the line.
########################## Prowl Action configuration ################################# # # the apikey for authentication (generated on the Prowl website) prowl:apikey=<my generated key> # the default priority of a Prowl notifications (optional, defaults to '0') prowl:defaultpriority=0 # the url of the Prowl public api # (optional, defaults to 'https://prowl.weks.net/publicapi/') prowl:url=https://api.prowlapp.com/publicapi/
Note that the URL used is different than the default. I think the default value is obsolete, as the page is not accessible.
Rule
It seems there are multiple ways to define the pushNotification, so I tried them all to see which notification I would (or not) receive.
var Timer front_door_timer = null rule "Front door" when Item EnOcean_sensor_frontdoor changed then if(EnOcean_sensor_frontdoor.state == OPEN) { if(front_door_timer==null) { front_door_timer = createTimer(now.plusMinutes(5)) [| pushNotification("Front door 1", "The front door has been open for 5 minutes! Is it supposed to be?") pushNotification("<api_key>", "Front door 2", "The front door has been open for 5 minutes! Is it supposed to be?") pushNotification("<api_key>", "Front door 3", "The front door has been open for 5 minutes! Is it supposed to be?", 0) ] } } else if(EnOcean_sensor_frontdoor.state == CLOSED) { if(front_door_timer!=null) { front_door_timer.cancel front_door_timer = null } } end
The first notification makes use of the API key and priority defined in the openhab.cfg file. The other two notifications override these values by defining the API key and or priority in the call.
What this rule does is the following:
- when the front door is opened, start a 5 minute timer
- if the front door is closed, abort the timer if it is still running
- if the door is still open when the timer reaches the end, a notification is sent
Addon
The prowl jar needs to be put in the openhab addons folder for it to work.
pi@webserver ~ $ ls -l /opt/openhab/addons/*prowl* -rw-r--r-- 1 root root 59510 Jun 16 04:26 /opt/openhab/addons/org.openhab.action.prowl-1.5.0.jar
Client
The client can be downloaded from the App Store. Unfortunately, it's not free ... But at $2.99 and for the sake of testing and being notified when something happens, I bought the app.
Test
As stated earlier, I defined 3 different notifications, each with a different set of parameters. I received all 3 of them, meaning that the syntax for each of them is valid, which is good to know.
The different syntaxes allow to experiment with different API keys or priorities depending on the notification.
The notifications appeared on my phone and the details could then be viewed:
This last minute feature is working!
Camera & LEDs Mount
As part of the pet care system, I used a camera to be able to watch the cats while they eat or drink. Later on I also found a wide angle lens for that camera.
I needed a way to mount these, including some LEDs to light up the direct environment. To do all of this, I designed a bracket and 3D printed it ...
This is the result:
Pfiew, all those small changes and hiccups add up and become time consuming ... But, it's almost done and Friday is getting very close, *eek* !