Author Topic: n00b Cutting Teeth on GarageMote  (Read 4327 times)

markushopkins

  • Newbie
  • *
  • Posts: 7
n00b Cutting Teeth on GarageMote
« on: October 28, 2013, 08:08:21 PM »
UPDATE: Edits based on Felix's response
UPDATE TWO - TESTED AND WORKING: See comment
UPDATE THREE - WEIRD BUGS AND WEBSERVERS: See comment

Hi all!

I'm completely new to the moteino, and I've only read about arduino and raspberry pi, and the only electronics soldering I've ever done was to replace a switch on a broken NAS, so really, I'm starting from square one.

First, questions for Felix (or anyone else that wants to chime in). Below, context!

About moteinos, it appears that if I buy two (with FLASH), they're loaded with a test sketch to confirm they operate correctly, and since I'm planning on an USB moteino, I should be able to connect to that one via USB and use it to wirelessly reprogram the other with the sender sketch for GarageMote, is that correct? I don't have ANY experience with FTDI, and I definitely don't have the equipment (and I'm trying to keep the cost for this specific project down since I'm only getting my feet wet here).
EDIT: Looks like I was wrong about this. Moteino's must be programmed via FTDI with code that enables them to be programmed wirelessly. However, since leaving an FTDI Adaptor connected to one of the moteinos apparently works fine, my new plan is to buy two regular moteinos and an FTDI adaptor. And I save money by cutting out the FLASH, so that's great too.


Next, about transceivers, I live in a townhouse with a detached garage (but only across a 4 meter patio), and the mac mini (which will be interfaced with the USB moteino) is maybe roughly 10 meters or less from the garage door opener (but through two exterior walls). What transceiver should I be using here? I read that the RFM12B has better obstacle penetration, but does it matter at that range? Does the RFM12B use less power if I ever wanted to add a battery powered moteino somewhere? If I want to eventually add a secondary thermometer sensor up stairs (basically directly above the mac mini), is that a consideration?
EDIT: Felix recommends RFM69W/HW. I refer anybody to someone other than me for more details on why, but if your layout is similar to mine, then you know what Felix's recommendation is too (at least for similar applications).

Last (two part question) is the cable you're using for GarageMote cat6? If I need to run one of the hall effect sensors out 2 meters from GarageMote, am I going to run into trouble (see last full paragraph, below)?
EDIT: Time to jump in and find out!
EDIT TWO: Works just fine (and that's at 4 meters)!

I've been reading the forum posts on the various moteino configurations, and I THINK I've figured out the best setup for jumping down this rabbit hole for the first time. I'll update this post as I go throught this project, but I'm trying to make sure I really have my bases covered before I take any actual steps. I have access to soldering tools etc (I work with an nice engineer), so I hope to be able to focus on the actual getting things done aspects of this.

After reading over the moteino docs and forum posts, the GarageMote post, and the Home Automation Gateway posts, I thought I might just skip the moteino altogether and connect a pi directly to the GarageMote shield, and then I realized I was going about this project ack basswords because I was stuck on using a raspberry pi.
EDIT: Here's a link to the Home Automation Post Comment where Felix explains for me how this *might* work. Read his comment in this thread for his point on not supporting this method.

I have a perfectly good mac mini at home already running as a media center, with at least one open USB port, so it occurs to me that the smarter setup is:

Mac Mini <-> USB Moteino <-> regular moteino <-> GarageMote

Is there any reason I shouldn't do things this way, and instead just do rasberry pi <-> GarageMote?
EDIT: Turns out this is even easier when running Ubuntu 13.10 than it is on a pi (apt-get FTW)

The great thing about cutting the pi (get it?!) is that it ends up costing less than using a pi+wifi dongle since I'm making use of equipment I have, AND I'll have a moteino hub for future expansion (I'm REALLY looking forward to nest opening up its protocols (as they say they will) so I can add thermometer sensors away from the thermostat; and now I'll be able to do it with a moteino).

I also noticed one difference in my garage opener is that it operates on a screw drive, and not a belt or chain. I can get away with mounting just one magnet on the door drive bracket, but I don't know enough of what I'm doing to know if one of the hall effect sensors from the moteino kit will operate properly on a cable that's 2 meters long instead of 16-18 inches [context for question for Felix above]. My thought was to place one sensor at door open position, and one at the farther closed position, and just use one magnet mounted on the moving bracket to trigger whichever sensor it is next to. Hopefully someone can tell me if this makes sense before I put it together and find out my door never reads as closed :).

I'll update with pictures and progress once I actually buy this stuff and get my hands dirty. Thanks for reading.

EDIT: Plan now is two regular moteinos, one FTDI adaptor (for sketch loading, and connecting one moteino to mac mini), GarageMote, and 2 meter cat5 cable (because of my screw drive garage door)
« Last Edit: November 13, 2013, 02:24:20 PM by markushopkins »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
Re: n00b Cutting Teeth on GarageMote
« Reply #1 on: October 29, 2013, 08:31:37 AM »
Hi markushopkins,
Thanks for all the questions, I will try to answer and hoping to cover all of them.
First, Moteino-USB is just Moteino + FTDI adapter, all in one piece. It's for those nodes that need to be plugged in all the time or be a master/gateway attached to a computer. You can always have a regular Moteino + FTDI adapter to do the same thing. The FTDI mates with the Moteinos using the 6 pin header that you solder on.

Moteino R4-USB by FelixRusu, on Flickr

The FLASH option is required for wireless programming but that is a bit more advanced topic. You would need to program your remote node with a specific piece of code that listens for a wireless programming command from the base. That topic is covered in the blog: http://lowpowerlab.com/blog/category/moteino/wireless-programming/
All Moteinos are tested to ensure programmability/usability/radio functionality. The FLASH is not required for functionality.

I would go with RFM69 (either W or higher power HW). The future of RFM12B is uncertain. RFM12B is also lower power, less feature rich. But still a good radio and very popular so not a bad choice.
Both are the same power in RX mode but different power levels in TX mode. Both can be adjusted for TX power level.

Another user asked about skipping the Moteino in GarageMote. You can do that but you're on your own. I have put together instructions how to make it work here: http://lowpowerlab.com/garagemote/
You could technically do this in many ways, but I try to stick to my solution because I cannot offer support for all variations since I don't know what exactly everyone wants to do different.

Your Mac mini setup sounds good.

I am using CAT5 cable (4 twisted solid core pairs). You can use longer cable BUT, it will drop voltage, see this voltage drop calculator : http://www.nooutage.com/vdrop.htm
Haven't tried but a few meters should probably not drop that much .. but at 3.3v signals it can still be significant. The only way to know is either calculate or try it.

Ah, I forgot about the screw drive openers... maybe because they are so rare?
Since the screw doesn't really move, just rotates, you'll need to find alternatives to getting an OPEN and CLOSED read. The sketch uses both. So you could mod the sketch to only require one... but then you don't know about the other states ... OPENING, CLOSING, UNKNOWN. One potential solution would be to mount battery operated moteinos on the door with a tilt sensor or perhaps one on the door wall which detects 2 magnets mounted on the door top/bottom .. somehow. But that gets complicated fast. See if you can just use longer cable. If it drops too much then feed the sensors 5V instead of 3.3v...

Let us know of the progress. Use linked photos (from picasa, flickr etc), this forum has a 192kb size limit for photos that makes them small/useless.

markushopkins

  • Newbie
  • *
  • Posts: 7
Re: n00b Cutting Teeth on GarageMote
« Reply #2 on: October 29, 2013, 01:56:00 PM »
I've edited my post based on Felix's responses, but here are a few more specifics.

I am using CAT5 cable (4 twisted solid core pairs). You can use longer cable BUT, it will drop voltage, see this voltage drop calculator : http://www.nooutage.com/vdrop.htm
Haven't tried but a few meters should probably not drop that much .. but at 3.3v signals it can still be significant. The only way to know is either calculate or try it.

That voltage calculator didn't have an option for 22-AWG or 24-AWG (cat5), but I found one tailored to cat5 here. Planning for worst case scenario, I listed 24-AWG 3.3v at 250mA (on one pair) at 5 feet and the calculator said there'd be no loss! All of this assumes the calculator is accurate for such short distances and low voltage, but I suppose I'll find out soon enough ;).

Quote
Ah, I forgot about the screw drive openers... maybe because they are so rare?

Yeah. When we rented this place I was surprised to find a screw drive too. Anyway, thanks Felix.

Time to spend some money!
« Last Edit: October 29, 2013, 02:42:21 PM by markushopkins »

markushopkins

  • Newbie
  • *
  • Posts: 7
Re: n00b Cutting Teeth on GarageMote
« Reply #3 on: November 07, 2013, 04:07:53 PM »
UPDATE TWO

The GarageMote is all soldered and tested. The hall sensor on the long cable works just fine (even though it's around 4-5 meters) on the normal 3.3v. I didn't even have to up it to 5v. Installation on my door planned for this week, probably Saturday. I'll post pictures as soon as that is done.

As it turns out, the soldering job was way over my head. Luckily, my boss is old hat at soldering, so he actually did it all for me, and thanked me for including him! I picked up a lot while observing him, but I still need practice before attempting it on something like this myself. Any recommendations for someone just starting out?
« Last Edit: November 07, 2013, 04:12:08 PM by markushopkins »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
Re: n00b Cutting Teeth on GarageMote
« Reply #4 on: November 07, 2013, 04:22:29 PM »
Cool!

About soldering...

Apply flux to clean metals from oxides and fats.
Keep your tip clean before you solder, heat both metals, then apply the solder. Most important principle: solder will melt and follow the heat, so if one side is cold you will get a "cold joint" and solder will not really want to melt and flow nicely into the joint.
When you're done, the joint should look wet, clean, tear-drop like.
GND planes and large metal parts will absorb heat, so you might need longer heating time, or hotter gun.
Get a decent iron ... you will not regret it. Hakko fx888 is a great one.
The only way to get good at it is to practice!

markushopkins

  • Newbie
  • *
  • Posts: 7
Re: n00b Cutting Teeth on GarageMote
« Reply #5 on: November 07, 2013, 04:25:30 PM »
Thanks Felix! Some of that was explained to me by my boss, but overall that's really helpful (it also makes more sense now that I've seen a few of those principles in action).

Apparently the FX-888 was discontinued. Any thoughts on the FX-888D?
« Last Edit: November 07, 2013, 04:28:22 PM by markushopkins »

markushopkins

  • Newbie
  • *
  • Posts: 7
Re: n00b Cutting Teeth on GarageMote [RF Problem]
« Reply #6 on: November 08, 2013, 05:05:03 PM »
I've gotten the moteinos all hooked up, and the sensors are still working fine.

I've run into a problem though. In testing, all communication between the moteinos worked as described by Felix, however, now that everything is installed, the base station moteino can send signals great, but it's not receiving ANY signal back from the sender moteino, even from a few feet away. I know the signals are getting to the sender moteino fine because the door opens and closes when the signals are sent.

I noticed that this behavior changed ONCE, and that was when the motor on the opener had stopped, but for some reason the opener arm moved another couple inches or so. When that happened, the arm moved the magnet straight passed the sensor (good thing I have extra magnets, so I can adjust the sensor so this won't be a problem), and the base moteino received the signal for what the sender moteino thought was a "door opening" event.

Could the motor on the garage door opener be interfering enough to block the signals sent from the sender moteino? Any other thoughts on what my be causing the problem?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
Re: n00b Cutting Teeth on GarageMote
« Reply #7 on: November 09, 2013, 09:35:27 AM »
Not sure but I suppose the motor EMI can be a cause.
Try this ... change the frequency of the Moteinos to something else (ie if you got 433s change the freq to 915 in the sketch, or vice versa). This will still work even though the signal quality will be drastically lower (lower RSSI), but for a test it should work. It will give you an idea if the same thing happens at a very different frequency. Hopefully if there is indeed EMI, then it won't be across the whole spectrum... :-\

markushopkins

  • Newbie
  • *
  • Posts: 7
Re: n00b Cutting Teeth on GarageMote [UPDATE THREE]
« Reply #8 on: November 11, 2013, 03:13:17 PM »
UPDATE THREE

Well, I've got everything mostly up and running.

The issue I was having before with the moteinos not communicating properly was caused by accidentally uncommenting setHighPower on one of my moteinos. All fixed now. Always double check your code, kids. ;)

I'm still troubleshooting one problem though. After about an hour of inactivity, the GarageMote can no longer open/close the garage door. The sensors work fine, and I hear the relay *click* *click*, but the door doesn't budge. Unplugging and plugging in the moteino fixes the problem until there's been another hour of inactivity, but obviously I'd like a more permanent fix. I'm going to be taking a closer look at it tonight to figure out if there's some difference in voltage or something after the hour, but right now I'm wondering if I can a), set the moteino to restart every half hour or so (haven't googled this yet, since I don't like this solution), or b) if upping the length of the relay pulse (default 250ms) would help, which I haven't tried either.

As for the webserver end of the equation, I've basically got it all done. Some of the nginx, nodejs, and socket.io stuff was a little different since I just created a vm of Ubuntu Server 13.10 on my mac mini instead of running off of a pi (I'm not running straight on the hardware because I'm exposing ports to the internet, so I'd rather this just run the one app). I went with 13.10 instead of the 12.04 LTS in order to take advantage of the nodejs package and the nginx package, which are only at or above Felix's requirements in Saucy Salamander. Notably, I didn't run into ANY issues just apt-get installing, even though the versions weren't precisely what Felix used, and he mentions that he had trouble with other versions in the post linked above. However, I'm not running on a Pi, nor ARM, so that probably has much to do with my smoother sailing.

Additionally, when I installed socket.io, I discovered that supplying the socket.io.js file breaks the setup, and that the version of socket.io (and client) npm installed (0.9.16) exposes it to the webserver itself at the webserver root location /socket.io/socket.io.js, so the source for this script on my install was:

Code: [Select]
<script src="/socket.io/socket.io.js"></script>

Finally, on the note of SSL certs, several years ago I found a company that provides free non-commercial ssl certs, and I've been using them since then without a hiccup. I can load the page in Chrome without having to click passed a warning page every time (which is incredibly nice). You can do the same at StartSSL. If you go this route, don't forget the cert bundles!
« Last Edit: November 11, 2013, 03:17:57 PM by markushopkins »