-
Thanks for the quick response @Gordon! I have a couple of issues with the approach you suggest: security risk, and the web-connectivity requirement that it presents. Both of them are non-starters for the application. What I really need is OOB pairing using the NFC interface.
I'll be going to C code for the final implementation, but was hoping to use Espruino for the 25 prototypes I'm building. It didn't seem supported at this point, but I thought I'd ask. Put it in the 'enhancements' bucket and see if anyone else is interested in this support going forward?
Thanks again,
Bill -
-
Thank you @Gordon! REALLY appreciate your help. The code is part of a DMX lighting protocol over Bluetooth to on-stage lighting effects. The show has its final dress rehearsal tonight and I made the appropriate changes and everything is working, just in time! I'll send you some photos of the result when the show pics are posted. It will run about 80 performances over the summer. I was concerned about someone in the audience connecting and stopping the advertising which would be a show-stopper (literally).
Thanks again! Bill -
Apologies @Gordon. It has been that kind of day for me. I was spending multitasking cycles with other projects and replicating it on a supported platform as was suggested. I wasn't aware of this specification limitation, so thank you. Interestingly, this has been eliminated for 5.0 since it is something that we actually want to do. Looks like a new softdevice to enable that capability :-{
-
Hi @Gordon, I tested the following on a Pixl running released 2v01 code. It ceases to advertise. When set to true for connectable, it works fine. It is reproducible.
Help? Bill
// // OSF Between Two Knees lighting effect translator // var count = 0; // for testing var i = 0; // port definitions const DMX_length = 18; const DMX_channel = 0x05; var DMX_data = new Uint8Array(DMX_length); // array to store DMX data received for (i = 0; i < DMX_data.length; i++) { DMX_data[i] = 0; } // // Initialize; set up // NRF.setTxPower(4); // +4 dBM (maximum) NRF.setAdvertising({},{ name: "PTG", interval: 30, connectable: false, // change to false before deployment manufacturer: 0x0583, // Code Blue Communications manufacturerData:[DMX_data] });
-
-
Hi @Gordon, just to simplify; I eliminated the second setAdvertising (it was added for debugging) and went back to changing the initial setup. In the following code, when the parameter is set to true, everything works. When it is set to false, the board ceases to advertise. Please try it for yourself...
The only other thing I'd add is that I'm uploading to flash (save on send = directly to flash).
Thanks for checking this out.
// // OSF Between Two Knees lighting effect translator // var count = 0; // for testing var i = 0; // port definitions const SCL = D26; const SDA = D25; const data_ready = D7; const DMX_length = 18; const DMX_channel = 0x05; // setup I2C I2C1.setup({ scl : SCL, sda: SDA }); // change to "input" for direct CPU connection from "input_pulldown" pinMode(data_ready, "input"); // for switch for testing var DMX_data = new Uint8Array(DMX_length); // array to store DMX data received for (i = 0; i < DMX_data.length; i++) { DMX_data[i] = 0; } // // Initialize; set up // NRF.setTxPower(4); // +4 dBM (maximum) NRF.setAdvertising({},{ name: "PTG", interval: 30, connectable: false, // change to false before deployment manufacturer: 0x0583, // Code Blue Communications manufacturerData:[DMX_data] });
-
Hi @Gordon, I assure you I'm disconnected from the IDE. Here's a portion of the code (setup), since there's a bit more involved. If you know DMX lighting protocols, this is advertising code for DMX over Bluetooth. I've tested this with the last line commented out (turn off connectability), and there is no advertising. I've also tried changing the 'connectability' parameter in the initial setAdvertising with the same results: once I turn off conductibility, the device ceases to advertise.
// // OSF Between Two Knees lighting effect translator // var count = 0; // for testing var i = 0; // port definitions const SCL = D26; const SDA = D25; const data_ready = D7; const DMX_length = 18; const DMX_channel = 0x05; // setup I2C I2C1.setup({ scl : SCL, sda: SDA }); // change to "input" for direct CPU connection from "input_pulldown" pinMode(data_ready, "input"); // for switch for testing var DMX_data = new Uint8Array(DMX_length); // array to store DMX data received for (i = 0; i < DMX_data.length; i++) { DMX_data[i] = 0; } // // Initialize; set up // NRF.setTxPower(4); // +4 dBM (maximum) NRF.setAdvertising({},{ name: "PTG", interval: 30, connectable: true, // change to false before deployment manufacturer: 0x0583, // Code Blue Communications manufacturerData:[DMX_data] }); NRF.setAdvertising({}, { connectable:false });
-
Hi @Gordon,
I'm using the espruino_2v01.10_nrf52832.hex load of firmware on a Nordic Dev board. I'm trying to turn off connectability, but keep advertising (this is a beacon application). Looking at https://www.espruino.com/BLE+Security and am usingNRF.setAdvertising({}, { connectable:false });
in my code. The device then stops advertising completely (I'm sniffing with nRFConnect to verify).
Is there something I'm missing?
Thanks,
Bill -
Thanks @gordon! I understand the aphorism is more truth than humor.
Thanks for the pointers to the code; it does indeed look like I might be able to make a version to implement the security I want as default behavior. I'll give it a try and let you know if I'm successful. It is worth trying to use espruino to have flexibility.
I'm using the NRF52832 dev board version and running it on an Adafruit board for a small project for a local theater. We don't want some smart patron to grab the peripheral with their phone.
Thanks again -- Bill
-
Hi @Gordon, yes as a peripheral. No on detection; I want to set up the security modes supported by Nordic to require the various security modes at the GAP layer.
For this specific application, I'd like to mandate LESC with Just Works (since I'm not worried about MITM protection in this application). If I end up coding this in C, I'll start from the Nordic example code in "LE Secure Connections Multirole Example".
I'm not sure whether this is covered in Web Bluetooth, but I'd think you'd want to be able to set the Security Mode and Level as parameters when setting up, perhaps in setting up advertising?
Let me know if the above makes sense. Happy to chat more about it; I've been getting involved in Cybersecurity in my consulting practice and need to be able to practice what I preach!
New aphorism I saw: "The S in IoT stands for Security".
Thanks! Bill
-
@Gordon Any support in the works for LE security modes control as a peripheral?
-
Probably @Gordon: Can an Espruino central connect/control more than 1 peripheral?
-
Hi @Gordon,
Sorry for the delay; other (paying) work... As it turns out, your suggestion got me to the right track inadvertently. I've had a serial-output sensor connected to Tx, Rx. When you suggested I connect to the default TX/RX, I couldn't because they were used. I think you get the picture... It was spitting out data whether or not the device was connected to Bluetooth. It appears that Espruino took it for debug port when disconnected and was sometimes messing things up when I tried to reconnect (or while disconnected).I moved the sensor UART to a different GPIO and it seems to be much happier. Does that make sense to you?
The project is an air quality sensor made from Adafruit parts. We've had a horrible fire/smoke season on the US west coast this year, and the air quality monitoring stations are rather sparse and do not report in real time. Most of the consumer sensors are handheld with a display and a bit expensive. I now have a Bluetooth, battery powered sensor. I'll be posting it once I get it tidied up into an enclosure. Probably post it to hackaday as well so that others can use it.
Thanks!
Bill -
Probably one for @Gordon, but please chime in if others have help - I'm trying to track down an issue with a couple of my designs. After some long-ish period of time (many hours or days) of not being connected, my sensor designs 'crap out' and need to be reset and reloaded with js code.
I'm doing something probably bad which is just to keep writing to Bluetooth (Bluetooth.println()) without putting it into a NRF.on(){} construct. In other words, it is trying to output to Bluetooth when not connected. I'm going to guess that not only is this not a good practice, but it may be filling up some buffer to the point of producing the 'crap out' behavior.
I'll try putting it into the appropriate NRF.on and putting some test time on it, but if you could let me know if this is indeed an issue it would help me feel like I'm on the right track to getting the sensor more reliable.
Thanks!
-
Thanks @Gordon and @Robin for the follow up. I'm a bit stumped right now, but will forward the email trail on to him and try to stop by in the next few days to help him out. He also has another Windows machine I'm going to ask him to try; I'm beginning to think there's something funny about his Windows 10 installation or updates.
-
Thanks @Robin; it really is for a friend. I do quite a bit with espruino (ask @Gordon), but on my mac. Seriously. But then again, I might not admit it if it were me...
I was trying to help him today: we had purchased a Plugable USB dongle since his PC didn't have Bluetooth and I've had excellent luck with the Plugable dongle in the past. We were able to run do the pairing in Bluetooth setup (what a bother, coming from the mac chrome IDE), and then when trying to connect with the native IDE, we kept experiencing hangs of that app. We tried removing the connection, rebooting, adding it again and couldn't make reliable connections. We also checked to see that the driver was updated for Bluetooth...
The 'documentation' inconsistencies aren't that per-se, but more that when you google in frustration "Windows 10 espruino IDE" you'll find references to it not working, working, Chrome plugin working with Canary, and other vestigial anecdotal info.
This is another reason I stick with the mac environment :-}
Could it be that this dongle just isn't up to snuff?
Thanks again!
-
Asking for a friend (I'm a mac person): he's having a heck of a time trying to figure out how/which IDE and how to talk to the pixl I had him buy...
What is the current strategy for Espruino programming on Windows 10? I find conflicting notes in this forum, and nothing we do seems to work reliably...
I've tried to convert him to using his mac, but he prefers his Windows setup.
Thanks in advance!
-
Thanks @Gordon! I have a capacitive sensor which ranges around 40-60 pF. I used the straight capsense using two pins with a 1M resistor and the sensor between them in series and it worked, but I wanted to understand/control its thresholds and resolution (prescaler) since the documentation is relatively meager for using it for anything other that qualitative finger presence.
This is my simple test code (I run it into Adafruit's Bluefruit for graphing):
// capsense trial... 082218 setInterval(function() { // console.log(Puck.capSense(D28, D29)); Bluetooth.println(Puck.capSense(D28, D29)); }, 100);
So when you say it counts up/down 100 times between logic 1 and 0, at what frequency? And from your description, it is using the definition of logic high and logic low for thresholds, correct?
I'll take a look at the NRF52LL reference. If I were to have my perfect solution, I'd be able to set thresholds so that I'm measuring proper time constants (say 2T at 86.5% or something similar). I'd also want to set the measurement/counting frequency to match the required timing/resolution.
Any thoughts or example snippets would be extremely useful as always.
-
I'm using a capacitive sensor and would like to know more about the details of capsense. The nRF SDK only references it in softdevice 12, I don't see anything in the newer versions. There's also the confusion of charging versus the (supposedly non-working) frequency method.
Any insights or documentation you'd point me to? I'm trying to tune the RC circuit. I'm assuming we're measuring the RC time constant, but a bit more detail will help me tune the RC for the timing and sampling rate I'm looking for. Clearly, it is measuring the time to charge, but to what levels? How are the comparator values chosen? How do we know when a conversion is done? Inquiring minds...
Thanks!
-
I always recommend your book :-} As you say, it has has its benefits and limitations. It is great to show what can be done with Espruino, but not a great reference for someone who wants to do something quite different and has at least some good programming experience/expertise.
I think that a good reference book would be invaluable and help promote it to a another (larger?) set of potential users (customers). My humble opinion, of course.
-
Hi All,
I've been spreading Espruino goodness and always have the question from others who are new to javascript, but not new to programming: where can I get a good reference book applicable to Espruino's implementation?
I frequently have the question of 'what can I do with a class' (say Serial) and would love to have a hardcopy reference nearby instead of popping open yet another window while debugging. Call me crazy, but I don't love working with multiple monitors.
So the question to the Espruino faithful: what would you recommend? Preferably with an amazon or ISBN reference.Thank you all in advance!
-
A public THANKS! to @Gordon!!!
Bill
Thanks @Gordon! I've already purchased 30 MDBT modules for DigiKey for this project, so the sale has already been made :-} I think touch-to-pair, OOB pairing is a great way to get good authentication and help make our solutions secure.
I'll keep the consulting offer in mind, but may indeed go and do a custom version based on the Nordic examples (HR, in particular). If I do so and get it working, I'd happily contribute it back.
That being said, I don't know how many Espruino implementations have a need for good security, but commercial products have an increasing visibility. See the story today about Russian hackers using iOT devices as entry points to hack larger systems. My $0.02, as we say in the US (conversion to local currencies left to the reader).
Thanks again! Bill