-
Thanks for the reply Gordon.
The device is a bathroom extractor fan called Pure Sense which would be tricky to post ;-)
I did some testing over the weekend and realised I needed to disable a lot of other Bluetooth devices in order for the Puck to discover it. Once I had the ID, I was able to enable the other devices and the Puck began connecting to the fan fine.
Not sure why this was the case, but I'm super happy that it works now. Takes around 30s to connect and send data but that's not a biggie.
Thanks for helping debug it!
-
No worries, thanks for trying.
It looks like the Puck isn't working for what I wanted it to do which is connect to a BLE device and send some requests.
I'll now try and get it to connect to a Raspberry Pi via Bluetooth and see if I can get the communication to work that way, it'll just mean an even longer lag :(
-
Thanks for helping debug this issue.
I have been reverse engineering a Pure Sense fan for the past few months by inspecting packets in Wireshark on the communication between the Android App and the Fan. By this process I was able to find out the Mac address, Device Name etc.
nRF shows the device as "LE only", Advertising Type "Legacy", Complete Local Name: "Pure Sense".
"Pure Sense" is the name of the Bluetooth device list when running on Raspberry Pi (in Python) and Web Bluetooth using JavaScript.
I cannot see why the Puck would be any different.
Do you have any idea on how I can change my code to free up the serial (if that's what I need to do?) I'm not sure this is the right approach since other Bluetooth LE devices show up in the scan.
It's worth noting that the description the Puck shows for each Bluetooth device is different too, there are no friendly names shown for any devices.
-
-
I tried to force the connection on Serial1 but now I've got an error 'Prompt not detected'
I really do wish this was simple. I was able to get this working in Python and Javascript fairly easily, something basic like finding a BLE device should be super simple :(
function onInit() { setTimeout(function() { Serial1.setConsole(); }, 1000); // ... }
also tried
function onInit() { setTimeout(function() { Serial1.setConsole(true); }, 1000); // ... }
-
-
-
-
Interestingly, when I try and define a service, the PuckJS disonnects from the WebIDE and I need to power cycle the device and refresh the page to reconnect. Defining an optionalService doesn't return the device but also doesn't crash the Puck
filters: [{ services: 'c119xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' }]
-
I am trying to connect the PuckJs to a Bluetooth device.
I have written code in JavaScript and it runs fine on the browser. I've written similar code in Python and it connects fine to the device.
However, the PuckJs just can't seem to find the device. I'm not sure why, since it's located very close to it.
The MAC address is:
4c:xx:xx:xx:xx:xx
and there's also a Device Name which I can filter by using the namePrefix in JavaScript.I've tried
NRF.findDevices
,NRF.setScan
, the results I get are odd. There is anid
field in each device, but none of them match the MAC address I want to connect to.Anyone know what I'm missing?
The JavaScript code that works is:
let device = await navigator.bluetooth.requestDevice({ filters: [ { namePrefix: 'P' } ], }); server = await device.gatt.connect();
When migrated to use NRF, no device is found:
NRF.requestDevice({ filters: [{ namePrefix: 'P' }], timeout: 20000 }).then(function(device) { console.log(device); });
results in
no device found matching filters
.I've also tried findDevice, setScan, with a large timeout and a max of 100 devices. I do get a lot of results (expected), but not the device I want.
To confirm, I can connect to the device via Web and also Python on Raspberry Pi, just not on the PuckJs.
Thanks!
-
-
-
Hey there,
I'm sorry, although I can code pretty well, all these terminologies are kinda lost on me. The pic of a button is attached, it doesn't require much force to push to be honest. I just need it to tap the power button at the top.
Is there a simple guide I can follow for the basics, something like this (but it's Arduino). They seem to use a hardware clock to limit the power draw of the servo which should increase the battery life.
Thanks!
-
Thank you for this, it's super helpful.
Since this is the first time I'm trying this, I think I'll get the clunky relay module (and then upgrade once it works as expected).
Which is the cheapest board that could do this? I guess Pico is great cos it's tiny.
I ideally want to run a timer on the board and then at certain times, activate the servo.
To help save battery life, am I right in thinking I could switch the power pin of the servo (without blowing it)? Do you have any articles that explains this in more detail?
I've seen this which seem to show a super simple approach:
https://www.wilsonleite.net/espruino-serĀvo/The adafruit site says "Never charge or use unattended.".
Is there a workaround for this, maybe safer batteries?
-
https://www.espruino.com/Servo+Motors
Hi all!
I've got a towel radiator which has a unit where you can press a button to turn it on an off. I'd like to use a micro servo to hit the on and off switch (by different rotations).
Since this in the bathroom, I don't have access to any power, would it be possible to run this on batteries? Are there any tips on ensuring the power doesn't drain too fast?
The article above mentions a hardware timer but I couldnt find any on the site.
Any help would be much appreciated
Thanks
-
-
Hi all,
I love the Logitech Harmony remote range but don't like how expensive it is. Since I know how to write javascript, I thought I'd try and make my own remote.
At the moment, I've got a Raspberry PI hooked up to a IR receiver and it is able to receive commands from different remotes to control my Marantz Amp, Panasonic TV and Apple TV.
I'd like to now build one remote (instead of using 3). Has anyone ever attempted this?
Ideally I'd like the remote to connect via Bluetooth to the Pi and send over custom commands which the Pi then controls.
I'd also like to understand if it's possible to remove the Pi altogether and get the remote to do all the heavy lifting.
Ideally I'd love a screen (may e-ink) so it's possible to know the state of some functions (like Voice mode on, Night mode on).
Any tips or links to tutorials would be much appreciated!
-
Thanks Gordon. I'll have a play around tonight on my Mac to broadcast a Bluetooth signal and see how quickly the pi picks it up.
If it's within 1s, that's great, if it's longer then I might go down the IR route since I only want to register that a button has been pressed, not really sending any extra data.
-
-
Hey all,
Is there a simple way for the Puck to notify a Raspberry Pi once it has been clicked with relative low latency?
I have a Marantz AVR and unfortunately, the remote isn't great, however it's got a good API and I've managed to code together some modes using Node JS.
What I'd like to do is when the Puck is pressed, either a HTTP endpoint is called or the Puck communicates directly with the Pi which in turn would run the relevant NodeJS code.
What's the best way for a low latency click being registered on a Pi?
Thanks Gordon,
I'm not sure what an active scan is. I was using a slightly modified version of the script in my original question.
The button, when pressed, makes a connection to the device, reads some data and sends some data. Since I'm doing it in a promise based approach, it takes a while for the data to be read / written. It's super quick in the app (around 1s or so) but takes around 30s on the Puck. I'm using LEDs to help signify that "something is happening". Will check to ensure I'm reusing objects as much as possible, pretty sure I am though.