Everything Xbee


#553

They operate from 2.1V to 3.6V. The USB power you supply is regulated down to 3.3V. I am more concerned about current but will have to play with that for a while


#554

Hi Xbee gurus,
I am hoping that people here will be able to advise me if Xbee is a solution to a potential problem.

I have a few items on there way from china including Xiaomi door sensors, Xiaomi Aqara Temp/Humidity sensors and Gledopto soposh light bulbs. My potential problem is, alot of this gear will be going in a part of the house that I'm not confident that it will communicate well with the HE. I only have one Zigbee switch in between the HE and planned location. The switch has also been reported to not route well. My plan is to build a Xbee router and place it central to the area with these new devices. The distance from the Xbee to the sensors and lightbulbs would be about 3 meters going through a one brick wall. Distance from the HE to the Xbee would be about 8 meters going around 1 corner. Direct from Xbee to HE would be a couple meters less but have to go through 2 brick walls.

Could anyone advise me if you think this setup would potentially work? I have also red in this forum that when using Xbee with Xiaomi you need a non A version of the xbee. Is this still true?

regards

Marko


#555

I have never heard of these but since they are zigbee they should be fine.

Will work great for the Xiaomi devices

not sure which you are referring to regarding the non A version
the only non A version I know of was not regarding Xbee but for Sylvania SMART+ Plug 72922 working with Xiaomi devices

Xbees MUST be zigbee versions of course


#556

Let's see/hear some of the ways you're housing and powering your Xbee modules.


#557

@dan.t I submitted a pull request in Github for the driver to add the Enable/Disable function from the ST Arrival Sensor Advanced driver. This allows the user to disable automatic detection of presence and set it manually during that time. VERY useful when your device isn't going to be battery powered. I've been using this code for a while it doesn't seem to have any issues that I can tell with your driver. So, @NoWon, this would be how you would be able to power off your cars 12v system and not worry about the sensor arriving when it is powered on in your garage.


#558

Had a question for the experts here....I'm looking at the XB3-24Z8ST-J:
image
Because I want to be able to mount the antenna outside my garage door under the overhang. When i approach my garage, I'm almost perfectly lined up with the door and I think I am getting interference with the giant metal door that's in my way. So, I figured with this one I could mount the antenna outside. So, which antenna is best to use? I've been looking on amazon and there are just so many different kinds and some say 5ghz and some say 2.4 and some say dual. I know i want one that supports 2.4 but would a dual also work okay? For example, would this one work:

Any advice on how to pick one out or tell a good one from a bad one would be very, VERY appreciated.

Thanks!!!


#559

I am using an old (15-20 years) 2.4 Ghz 9 or 12 dBi (I don't remember) I dug it out of my junk box which works fine.
Most of these new ones that use magnetic bases use weak magnets likely because strong magnets could cause interference.
also you will want to point the antenna straight up or down.
A dual band should work fine.
I generally choose the Amazon prime product with the most number of good reviews.


#560

Thanks!


#561

very impressed!
They were not kidding about the range!
finally had time to test out one of my Xbee3 XB3-24Z8ST as an arrival sensor
I changed it to an end point and used an old Asus dual band wifi antenna (maybe 1-2 dbi could not find the specs)
asus
set on the dash of my car.

and an old 2.4 wifi omnidirectional antenna (I think it is a 12 dbi) attached to another Xbee3 XB3-24Z8ST set as a router in the second floor corner of my house.

It picked picked up the Xbee3 arrival while driving 1/2 mile (600 meters) away.
I could likely do better with a better antenna in the car but 1/2 mile is plenty.

compared to the SmartThings arrival sensor which will only pickup at best when walking 2-3 houses away or in the car it is usually in the driveway before detected.

driver issue: (cosmetic)
The Xbee3 device display shows 2 sets of
"Minutes elapsed until sensor is not present *"
one says "click to set"
and the second says
"3 minutes"
I set both to one minute and they still display
"click to set"
and
"3 minutes"
but still functions with the selected 1 minute selection.

As far as powering the Xbee3 arrival in the car I am going to leave it only powered using USB so it is only present when the car is running. This way if any of the kids get out in the garage and keys happen to be within range of push to start or command start happens to start the car my garage door will open.

I updated the original post for end point settings (I didn't need to change SP settings)
AP = 0 (for an end device)
SM = 5 (has to be not 0 for end devices)
and I just pressed reset on the USB board to get it to change from router to end device.

Thanks Dan.t !


#562

Come on guys! I was perfectly content with my little chip antenna Xbees. Now I have a voice in my head repeating, “Need more range”. Back to Mouser, I go.:smiley:
All joking aside, thanks for another fun project!


#563

Love it. I didn’t get to play as much I wanted to yet as I am traveling for work. I am not sure if a 1/2 mile is too much for me... I might have to play with the PL parameter a bit to find the sweet spot, would rather fire presence a bit closer to home.


#564

I just tried this out, and it works great! I had to use my Xbee 3 as my Xbee S2C did not have the PS parameter, presumably because it is not a programmable model (I think that distinction was done away with in the Xbee 3 generation, as I no longer see them listed separately). I also had to put the main.py file in /flash not in / (what I'd call "root" having no experience with the device). I did not have write access to /, and the Xbee docs suggest /flash is indeed the correct location (and also the default). I'm also getting a Groovy error for line 136 of the driver, def timeSinceLastCheckin = (now() - state.lastCheckin ?: 0) / 1000, about an overloaded minus operator and inability to determine which is appropriate to use (obviously I don't remember much about this error and it's long gone in my past longs, so we'll see if it comes up again--may have just been something that happened the first time the driver ran).

Oh, and I'm not really using it as a presence sensor. I just want a way to know that my Xbee is checking in with Hubitat and staying on my network. To that end, I set the timeout to 5 minutes in the driver preferences (would probably make this a bit higher if I didn't have to modify the code), changed runEvery1Minute to runEvery5Minutes (so it checks less often too), and I changed the Python on the Xbee to only wake every 5 minutes as well. This way, I figure my Zigbee network will get less traffic and I'll get resolution somewhere between about 5 and 10 minutes for determining whether my Xbee has been offline (i.e., "not present") for a while. I might actually venture into using one as a real presence sensor some day (have to figure out power...), but this is still great for now. Wouldn't do much good for me since I rarely drive, but could be good for telling if roommates or whatnot who do are here and adjust my automations accordingly. :slight_smile:

Thanks for your contribution!


#565

@dan.t
first I was wrong the "minutes elapsed until sensor is not present" has stayed at 3 minutes it is not taking the selected change.

quick questions
you have the micro python transmit battery every minute which it is.
but looking at the logs the presence check in varies from 76 seconds to 12 seconds it appears to drift in check in time.
How is the check in being triggered?
I see in the main.py code you have
time.sleep_ms(60000) will it delay the initial response for check in if in sleep mode? (do I really need this since I will not be using a battery)

Why I am asking is you can drive quite far in 76 seconds if the cycle happens to transmit just outside of the zigbee range.
I drove around a bit testing other antennas in the car and could reliably get on average at least a 1/4 mile every time.
Sometimes less though sometimes more.
So range will depend on peoples antenna setup and check in timing.
The SmartThings Arrival sensor reports every 20 seconds it does not appear to drift.

Since I will only be powering mine when the car is running I will not have to worry about flooding the hub with info or draining an Xbee battery.

so far it has been very reliable.

@bertabcd1234

What exactly did you change/add in the python code?

import xbee
import time
import binascii
import sys
x = xbee.XBee() #Create an XBee object
while True:
voltage = x.atcmd('%V')
print("Voltage at " + str(voltage))
tx_req = ("7E"+"00"+"05"+"2D"+"01"+str(voltage))
try:
xbee.transmit(xbee.ADDR_COORDINATOR, binascii.unhexlify(tx_req))
except:
print("Error occured to send package, probably not connected to ZigBee network")
print("going to sleep now")
time.sleep_ms(60000)
if x.wake_reason() is xbee.PIN_WAKE:
print("woke early on DTR toggle")
sys.exit()


#566

I am traveling right now so it is hard for me to test/debug things. But here are some answers:

Even though you don’t use batteries, the message is used to detect presence. The idea in the code is to send the battery status on a regular basis and the driver takes that battery message to detect the xbee being present. After a timeout of X minutes not receiving that message, the driver will make the Xbee as not presence. There is no “disconnect” message that the Xbee sends.

You change the time.sleep_ms to 300000, that reflects 5 minutes. However, you would also need to change the driver. I would not expect those skew times your are seeing. At least I haven’t seen them and I have that code running on my router Xbee right now. But I will certainly look at it.

In regard to range: I would actually not change anything in the code. First thing I wanted to try to play with the PL parameter of the Xbee. I bet you have it set to 4 which is maximum power. Set it to 1 and see how far you will get. I bet it won’t be a 1/4 mile anymore.

I am back home by the end of the week and will continue my testing and cleaning up those code errors. I also ordered myself a 3V LCD display to connect to my “driving around Xbee” to have an easy way to see what the status is while driving around.


#567

ok I understand
I misunderstood the logs I was reading like a SmartThings arrival sensor log.

that is just the "sensor checked in" time in the driver since the last battery report.

So then I would actually want the battery check in a lot more often since you can drive fairly far in 1 minute.
The 1/4-1/2 mile is just fine for me as is but most people will not have a 12 dbi antenna laying around. So being able to send the battery report more often would be better.
like every 20-30 seconds Similar to the SmartThings Arrival sensor reporting.
This would make the range of check in a lot narrower.

I am going to test 2 - 5 dbi antennas one on each Xbee and see what sort of range they do as this is what most people will have lying around.

as far as the driver display for devices and displaying double
"Minutes elapsed until sensor is not present *"
it only showed double on my end device and did not change settings on it
On my routers it showed a single set and changed fine.
so I deleted the Xbee3 end device and re added it now it appears fine and takes the selected changes
very weird Hubitat glitch


#568

I actually worked off the ST v2 presence driver. They do the same thing. I am not sure how often they send the Zigbee status though since I don't have a physical unit.
Keep in mind, the probability that you have to wait a full 60 seconds for presence detection is low. Since it is a timer, you will most likely be somewhere in the middle, like 20 - 40 seconds.

I chose the 60 seconds since I run the same code on my routers and I don't want to flood my Zigbee network.

I could put an option in the driver to configure the piece of SW that runs on the XBee to be able to adjust the timing.... I'll take a look at this when I have some time.


#569

I have changed the timeout for the sleep in the micropython program to 15 seconds, so it sends a report every 15 seconds. However, I am also disabling the device via the driver because I am using my car's USB port to power the board. So it isn't on for very long when I am home and therefore won't jam up the traffic on my network.

I do have two questions though:

  1. Is there a way to force the board to use a specific repeater as it's router?
  2. Is there a way to force the board to keep the same network address? It seems that whenever I make any change to anything that the board gets a new network ID and I have to rejoin it to my zigbee network in HE.

Thanks!!


#570
  1. no unfortunately easiest would be to power off all routers you do not want when you first add the Xbee or just keep retrying until it pairs though the desired router.
  2. no not that I have found I tried that with other devices in the past and I believe the router assigns network id only the mac address says the same.

what do you mean "I am also disabling the device via the driver" ?
I am disabling the device by turning of the car which powers off the car's usb port.

I thought even if the python code was adjusted the driver code would also have to be adjusted to be able to poll every (in you case 15 seconds) but I have not had a chance to really look at the driver code (not that I am very good at it but I understand the basics).


#571

I have 4 Xbee3 three are routers and the 4th is an end device arrival sensor.
After running a scan in XTCU I noticed the end device was connected to one of my router Xbee3 connected to my computer not the window Xbee3 router.
So I powered off my computer Xbee3 routers and only left the Window Xbee3 router on. Then started my car and the Xbee3 end device became present.
I powered my computer Xbee3 router back on and re-scanned my network and as expected the Xbee3 end device was routing through my window Xbee3 router.
As a final test with all my Xbee3 stilled powered on I turned off my car and let the Xbee3 end device go departed then restarted my car and the Xbee3 end device became present again.
I then recanned my network and the Xbee3 end device had changed Xbee3 routers again.
So unlike Xiaomi devices which stay locked to initial pairing routers.
The Xbee3 route through the first router linked to your hub it sees.
Why it does not go to the stronger window Xbee3 with the 12 dbi antenna first in this test is it is parked almost directly below the 12 dbi antenna Xbee3 and omni directional antennas create a doughnut like signal with dead zone weaker signal in the middle.


#572

No, that's not true. The driver code merely looks at the time between check-in for how long it takes to go not present when it leaves. The timeout in the python code is the time between transmissions. So, if you wanted to modify the time it takes for it to detect that the sensor has left, you would have to modify the driver. In my case, I'm only using it for arrival, not departure.

I also modified the driver so that when it is disabled, it always reads as present. That way, it doesn't "depart" when i turn my car off or "arrive" again when I start it up. Makes things a lot easier.