Avatar for Nic

Nic

Member since Mar 2019 • Last active May 2020
  • 2 conversations
  • 9 comments

Most recent activity

  • started
    • 9 comments
    • 129 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for Nic

    Thanks for the code. I tried it and whilst it does only fire the event when there's movement, unfortunately there are side effects. In/Out fire with just a fraction of movement when the conditional is set +/- 6000. I've removed the change for now, but it's not working exactly like before. Do I need to reset the register? I'm only sending the code to Puck at the moment, no save.

    You weren't kidding about the level of configurability! I'm torn on modules vs. firmware, but I'd probably agree with you - it would likely be easier to develop and use.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Nic

    If it continues being an issue I'll see if there's anything I can do.
    I know the accelometer can be configured in a bunch of different ways
    so potentially it could be told to sleep until moved, avoiding waking
    the Puck up.

    Ah, thanks! I'll let you know how it goes. To be honest, that's kind of how I expected it to work. When setting up I was a bit shocked to see it take continuous readings. That's initially why I was trying take a single reading so I could mark roughly where I wanted the "action points". Ended up wrapping it straight into a conditional and tweaking the values.

    I do use the counter approach: action and sensor counter. I advertise the light, temperature and battery every 1000ms and update every 5 minutes - as well as the readings themselves, it's just a useful heartbeat to make sure they're working OK.

    When an action occurs: increment the action counter, set the action value, increase the interval to 20ms and set a timeout to revert back to 1000ms and set action to zero. The last point is the problem, and for the cat flap I have increased the amount of time it advertises the action at the faster interval before it resets to 0 to ensure a packet arrives!

    I use the same code across all the Pucks I have: doorbell, our cat logger (single, long and double press for meal, snack and water replacement - so he doesn't get fed twice!), dinner is ready announcement button which plays to all rooms. The other half has a button to turn the kettle on so she can get ready for her shift while it boils, another which works in tandem with a motion sensor to enable a "shower mode" so the light doesn't go off. All kinds of silly little uses really!

    I increase the interval time to account for the doorbell mainly; wanting an instant reaction. I reset the action ID because I burnt myself a few times when I was first creating the receiving script. I didn't account for the script restarting and an action being in place - the doorbell going off at silly o' clock was not great! Scared the s*** out of us!

    Also a similar silly little bug led us to think the cat was pressing the button during the night as we were getting notifications that he was feeding himself! He knows the click it makes and knows he's being fed so we genuinally thought for a bit that he was getting creative - he's more of a dog in the body of a cat...

    Anyway! Yes, I think I'm just about over the "doorbell incident", aha. I could remove that fail-safe now, and you're right it would definitely help.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Nic

    Sorry, I should have probably been a little more descriptive than "it didn't work"! On the original firmware Puck.accel() returned the object correctly but all the values (X, Y and Z for acc and gyro) were zero. I don't think I called it directly on the device; rather I wrote it to the device each time I tried - so it's probable that it was taking the last reading and there wasn't one...

    It has been a few days now since it's been attached. The cat has always been a little tentative using the cat flap and he's a little more so now there's a Puck right in the middle of it - nonetheless has been using it. Then again, I think I'd be a little tentative too if I had to open doors with my face! I will probably offset it so he's more comfortable.

    I've had a few teething issues. It's quite a distance away sitting at the furthest point in the conservatory - something I didn't initially give much thought too. The signal was a little weak for the RPi to pick up consistently.

    I moved the Pi about a foot and a half along the unit it sits inside the house to be as close as possible to the Puck. I tweaked the Pi enclosure a bit and disabled unnecessary Wifi and Bluetooth on other devices near the Pi to reduce interference. With those tweaks it has been flawless.

    I've been monitoring battery life too and it's depleting faster than I would like, despite running accel at the lowest Hz. E.getBattery() reported 80 right from the get go though - it's now at 60 (accounting for temperature fluctuation). It might just be a bad battery. I was running the same code as the other Pucks which included code to watch the button - I've removed all unnecessary code now to see if there's any improvement.

    It is working though! We get a notification when he comes home, one when he leaves and I write it to his log in our app. I hope the Puck is resilient enough that I can repurpose the motion sensor - drives me nuts when he's just laying next to the cat flap and rolling around in the sun - to which we receive many notifications and if we're out have no idea whether he's in or out without checking camera feeds. When the day comes we're out in the evenings it will be great to know for certain whether he's in or not as the camera doesn't always pick him up.

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Nic

    Hi,

    I received my V2 Pucks today (thanks Gordon, for sending out so quickly) and I thought I'd have a little play with the new functionality.

    I have been using a motion sensor above the cat flap to monitor our cat going in and out; the problem is I have no way of deducing which direction he's going!

    So I thought I'd stick one of the Pucks on the flap and use the accelerometer to determine whether he's going in or out. It's all coded in, sends a notification much like the original sensor and works a treat!

    It still needs to be cat tested; I hope he still fits through and I hope he doesn't pull it off! I've had to move other Pucks out of his reach as he enjoys batting them around!

    Just a note: Puck.accel() didn't work with 2v05 shipped on the device. Upgraded to cutting edge build and worked fine - probably known by Gordon, but just in case anyone else has trouble! Puck.accelOn and event worked fine though.

    Just thought I'd share!

    Thanks!

    Nic

    Sorry! Should have posted under projects :(

  • Avatar for Nic

    Hi Gordon,

    It turns out I'd make a mistake. No issue to see here!

    Thanks!

    Nic

    • 8 comments
    • 1,176 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for Nic

    Hi Gordon. Thank for the reply.

    I had already tried adding more packets and varying the order of things but didn't have any success. It was a bit of a frantic day but I am pretty certain my changes were minor and unrelated to the advertising/iBeacon code.

    Nonetheless, I do have that version. With a clear mind I'll have another go and see if I can get to the bottom of it.

    I was sure this code was and had been runnning correctly up until I re-uploaded the code. Very strange.

    I'll let you know how I get on.

    Thanks,

    Nic

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Nic

    Hi Gordon,

    I was sure this was working... I've just done some code tweaks and found it to be unreliable again. I flashed to the newest edge build in case further issues had been rectified but alas I can't get it to work.

    Here's my code:

    function AdvertiseData(Interval) {
        NRF.setAdvertising([require("ble_ibeaconĀ­").get({
              uuid : UUID, // iBeacon UUID
              major : 0x0001, // optional
              minor : 0x0001, // optional
              rssi : -79 // optional RSSI at 1 meter distance in dBm
            })],{manufacturer: 0x0590, manufacturerData:[SensorID, Light, Temperature, Battery, ActionID, Active_Press_Action, Stuck], interval:Interval});
    

    Noble detects the iBeacon as the manufacturer data and the array of data is never picked up. If I pad it with another value preceeding the iBeacon like so:

    function AdvertiseData(Interval) {
        NRF.setAdvertising([{0x180F : [0]},
            require("ble_ibeacon").get({
              uuid : UUID, // iBeacon UUID
              major : 0x0001, // optional
              minor : 0x0001, // optional
              rssi : -79 // optional RSSI at 1 meter distance in dBm
            })],{manufacturer: 0x0590, manufacturerData:[SensorID, Light, Temperature, Battery, ActionID, Active_Press_Action, Stuck], interval:Interval});
    
    }
    

    Noble picks up the array of values but the iBeacon isn't working.

    Any ideas?

    Thanks

    Nic

  • in Puck.js, Pixl.js and MDBT42
    Avatar for Nic

    Hi Gordon,

    Typically my tests probably always included an even number of messages. I flashed to .69 and it works now as expected.

    Thank you for your help!

    Nic

Actions