Please post what you're working on!

Posted on
Page
of 7
Prev
/ 7
Last Next
  • I put together a simple color-coded compass using the Puck's magnetometer. It's admittedly less robust and doesn't contain much sophisticated math, but it more or less matches readings from my smartphone's compass app. See attached file.

    Color Codes
    Red, Green, Blue Sequential Flash = North (330 to 30 deg)
    Solid Red = East (60 to 120 deg)
    Solid Green = South (150 to 210 deg)
    Solid Blue = West (240 to 300 deg)

    Possible enhancements:

    1. Turn compass on/off via button click
    2. Fade color in/out between cardinal directions. For example, when pointing to 135 deg, both Red and Green LEDs should be lit. As directions moves more toward 90 degrees, Red gets stronger and Green gets weaker. Or at least something similar to indicate intermediate directions.


    See this thread for more sophistication: http://forum.espruino.com/conversations/297915/


    1 Attachment

  • @benddennis a fine job on the compass.

  • @bendennis I have solid green when I try this. Console reports bearings within the green range, but I don't think they should be. I'm changing all orientations.

  • @Ollie Did you use the same offsets (x0, y0, and z0) or adjust them based on your own puck's readings? I took 4 separate readings (turning every 90 degrees +/-), and then averaged The X, Y, and Z values. I did this per a suggestion by from another post @Gordon.

  • I didn't adjust anything - wasn't aware I needed to TBH. I'll check out the post you link and give it another shot.

  • Wow! There's some great stuff here!

    @Joakim nice idea! Also, really fun to see it painted :)

    I wonder if you could just set up a shortcut key on the Mac, and then turn the Puck into a BLE HID Keyboard that did that shortcut? It'd mean you didn't need node running (but at the moment a constant BLE connection would use up the battery faster).

    @Tobi @Fisu I love those reaction testers :) I wonder if you could use Eddystone or NFC to broadcast your score in the form of a URL?

    @thedamos @allObjects yes, the light detection uses the red LED. I go to some lengths to try and make sure you still get the same light readings even if you'd previously turned the red LED on - however there was never any code in there to cope with what happened if you used PWM on it while reading the light, and that could have caused some issues?

    I love the night light idea though. It's just nice and simple. You might find the battery doesn't last too long though - with the red LED on you're looking at ~100 hours I think.

    @benddennis nice compass! I guess one option would be to auto-calibrate (store the maximum + minimum compass readings and then subtract the center reading). It'd get confused if you took it near a magnet, but I guess the button could re-start the calibration.

  • I made a Media Controller, please take a look :D

    http://forum.espruino.com/conversations/298144/

  • @tc You just beat me to posting this :) I had a similar idea I've been building in the recent days, especially rotation for volume control.

    Mine's here: https://github.com/rsmeral/puck.js/

    I modularized it into these

    • Button - emits events for single/double/long/multi press

      Button.on("double", ()=>console.log("I got double clicked!"));
      
    • Proximity - emits "far" and "close" events, emulating a proximity sensor (based on light)

      Prox.on("close", ()=>console.log("close"));
      Prox.on("far", ()=>console.log("far"));
      
    • Scroll Wheel - emits "plus", "minus" and "notch", based on magnetometer

      Knob.on("plus", hid.volumeUp);
      Knob.on("minus", hid.volumeDown);
      Knob.start();
      
    • Lights - (WIP - works, but needs tweaks) - pretty API to control the LEDs

      Lights.pulsing().color(Lights.BLUE).when(Button, "down").until(Button, "up");
      Lights.blip(Lights.CYAN, 500);
      Lights.steady().rainbow().now().for(5000);
      

    The VolumePlayPause demo is quite fat (especially due to Lights being fat) - when I load it through the Web IDE, it gives me Out of memory error, but when loaded through CLI, it works OK. Most likely the difference is in minification.

  • @Ron yours great!!!!

  • @Ron, nice work. I would suggest "near" and "far" events as "close" can be confused with the verb close as in shut or end, often associated with streams.

  • @CanyonCasa Thanks, good point! Fixed.

  • I'm working on a wearable watch light meter for manual photography. I shoot film with cameras that don't have built in exposure meters and it would be nice to have one on my wrist. Doesn't have a display yet but I can use my iPhone to read the value via Adafruit's Bluefruit console. I just got this prototype working about 10 minutes ago :D

    Code is here: https://gist.github.com/maxogden/1d9715a448f64513507623090f27c437
    Sensor is the TSL2591 breakout from Adafruit. Watch is from https://www.tindie.com/products/deadbeelabs/strapon-purple/

    Warning: I'm a software person, not a hardware person :)

    I have the Puck's battery holder hot glued to the bottom of the circuit board to act as a pivot point so I can depress the entire watch face to have the puck's momentary button switch engage. It even works one-handed if I have the watch on snugly and flex my wrist upwards.




  • Nice! I think this is the first project I've seen where someone's connected external circuitry to it!

  • Hi Gordon & Community,

    I am currently looking into a eHealth prototype using the puck. The idea is that elderly people wear the puck as akind of necklace and it can be used for things like:

    • via BLE beacon scanning, we roughly know where the person is
    • it detects a person falling via the accelerometer
    • it detects a person having an issue if has not been moving for a certain time
    • pressing the puck once will call for assistance
    • double-pressing will call for immediate help
    • if care is taken of a patient, the caretaker will scan the puck via an NFC smartphone to record the care actions

    This is also the reason I am looking into the http proxy with EspruinoHub. I want puck to scan for ble beacons every few seconds, then the closest beacon should be reported to an HTTP api. The same for button presses or the fall detection.

    This is very early, we're just beginnging to look into it. From a technical point of view, I think it is very much possible. Could I get some comments and ideas from @Gordon and the rest of the community?

  • There's no accelerometer on board. I was trying to do something to detect speed using the magnetometer, but didn't have a lot of luck. Changes in orientation are easy, speed in a direction not so easy. I'd be interested if other people have had more success with this.

  • @hansamann Great idea!

    There's no accelerometer though, only magnetometer. That could still be used for fall detection with lower reliability, through sudden changes in rotation. Perhaps a machine learning algorithm could distinguish a fall from noise.

    For location detection, maybe you could reverse the logic - have logic on the hub scan for Pucks, not the other way around. It would save the battery, and not add any extra hardware, since for your original scenario, you already need hubs spread around for the Pucks to connect to as proxies.
    See e.g.
    https://developers.redhat.com/blog/2015/07/31/behind-the-internet-of-things-middleware-demo-at-red-hat-summit/
    https://github.com/starksm64/NativeRaspberryPiBeaconParser

    What sucks with NFC API now is that the only type of content that can be set is a URL, but that still works.

  • Sounds like a good idea...

    So you actually want to use the Pucks themselves to effectively triangulate where someone is?

    If you're just after reporting signal strengths back down WiFi I'd seriously consider using the hub directly though, rather than a Puck (as keeping scanning for nearby beacons will drain the battery relatively quickly).

  • thx for pointing that out, I am thinking of adding one. Is there an accelerometer that you would recommend based on great APIs that are available on espruino? I think these adxl accelerometers are cheap, but of course even the smallest board adds to the overall size. But this is where the 3d files come in handy, as I can design a bigger enclosure with the same fitting puck in the middle for example.

    so, wiht an accelerometer - I would every few ms check for the gravity and if that dramatically decreases, your either in an elevator or falling... any ideas?

  • thx, great feedback. You're right, I already need multiple BLE proxies (raspberry PIs), so why not reverse the logic. so the puck would be a beacon in this case, I assume. Makes sense, I will think it through.

  • Hi @Gordon, I might reverse the logice based on the feedback received, but the idea was to scan for the strongest beacon every minute or so. The code that does this is fairly simple and worked fine in a simple test. see below.

    In this scenario, an home for elderly or our setup for an event, we're effectively able to control the BLE devices in the environment. So per section that I want to have a location reported, I would place one beacon right now. But again, maybe I am just turning this around, I need to think about it. In the end it needs to be fairly simple to setup and demonstrate, I might still have tendency to go with the scanning on the puck directly.

    setInterval(function() {
      NRF.findDevices(function(devices) {
        var nearestDevice = null;
        devices.forEach(function(device) {
          if (nearestDevice === null)
          {
             nearestDevice = device;
          }
          else if (device.rssi > nearestDevice.rssi)
          {
            nearestDevice = device;
          }
        });
    
        if (nearestDevice)
        {
          console.log(nearestDevice.id, nearestDevice.name, nearestDevice.rssi);
        }
    
      }, 2000);
    
    }, 5000);
    

    @Gordon do you have a recommendation for the accelerometer that I need to connect as well as for doing free-fall detection?

  • I don't I'm afraid... I imagine you want a low power one that has a programmable IRQ line on it (eg, that can be programmed to detect freefall).

  • For your use case the magnetometer might be sufficient, given how it is to be worn..

    Between set times (so not triggered by sleeping) if there was not much movement from magnetometer that would suggest wearer immobile. So this would pick up people who had fallen, but also those who who were incapacitated for other reasons - asleep, sick, laid up in bed etc etc.

    Just a thought.

  • Couldn't there be false positives caused by a fluctuating magnetic field that the magnetometer picks up (or something like that, I'm not educated on magnetism)? It could appear as if the wearer was active, even though the person was immobile.

    Also, isn't this a field many are trying to get into ("e-Health")? There could be accelerometers out there that specialise at detecting falls.

  • I guess. The readings fluctuate a little even in a stationary device. But when I was messing with it you had to be moving it about to get large movements in readings. So a threshold might be safe.

    Just trying to work with what we've got :)

  • Looks like the ADXL345 is nice and it has FF free fall detection. I am a bit troubled with activating it, but I am sure it will work in the end. thx a lot!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Please post what you're working on!

Posted by Avatar for Gordon @Gordon

Actions