-
Here it is:
Please noteDevName
,serviceUUID
,characteristicUUID
andMessageToSend
have been replaced in the code below because of confidentiallity agreement.var devices; var gatt; var DevName="MyActuator"; var serviceUUID="2fc3af42-7a4a-1431-d1f1-fs551e3bf022"; var characteristicUUID="32160fb9-5337-4e71-b0f8-ff412e3ae078"; var MessageToSend=[0x00,0x01,0x03]; function scan(){ NRF.findDevices(function(d) { devices = d; console.log(devices); }, 5000); } function SendCommandToActuator() { NRF.requestDevice({ filters: [{ name: DevName }] }).then(function(device) { return device.gatt.connect(); }).then(function(g) { gatt = g; console.log(gatt); return gatt.getPrimaryService(serviceUUID); }).then(function(service) { return service.getCharacteristic(characteristicUUID); }).then(function(characteristic) { return characteristic.writeValue(MessageToSend); }).then(function() { gatt.disconnect(); console.log("Done!"); }); } function Bond(){ NRF.requestDevice({ filters: [{ name: DevName }] }).then(function(device) { console.log("found device"); return device.gatt.connect(); }).then(function(g) { gatt = g; console.log("connected"); return gatt.startBonding(); }).then(function() { console.log("bonded", gatt.getSecurityStatus()); gatt.disconnect(); }).catch(function(e) { console.log("ERROR",e); }); }
When I load this script and I call
SendCommandToActuator()
, I get this log:> _____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v94 Copyright 2016 G.Williams > =undefined >SendCommandToActuator() =undefined BluetoothRemoteGATTServer { "device": BluetoothDevice { "id": "96:05:05:f7:ac:1c random", "rssi": -61, "services": [ ], "data": new Uint8Array([2, 1, 4, 12, 9, 79, 75, 73, 78, 45, 54, 50, 54, 48, 49, 57]).buffer, "name": "MyActuator", "gatt": ... }, "connected": true } Uncaught Error: Unhandled promise rejection: Disconnected
-
-
No it doesn't say timeout anywhere, it is just a potential cause that I suspected.
The peripheral is an actuator. Basically I have to send 3 bytes to a specific characteristic in order to control the actuator.
I try to bond it with this methodfunction Bond(){ NRF.requestDevice({ filters: [{ name: Devname }] }).then(function(device) { console.log("found device"); return device.gatt.connect(); }).then(function(g) { gatt = g; console.log("connected"); return gatt.startBonding(); }).then(function() { console.log("bonded", gatt.getSecurityStatus()); gatt.disconnect(); }).catch(function(e) { console.log("ERROR",e); }); }
This process seems to be OK. It returns
bonded { "connected": true, "encrypted": false, "mitm_protected": false, "bonded": true }
Then I try to write to the specific characteristic of the specific service and again, I got error messages like following:
BluetoothRemoteGATTServer { "device": BluetoothDevice { "id": "96:05:05:f7:ac:1c random", "gatt": ... }, "connected": true } Uncaught Error: Unhandled promise rejection: Disconnected
I don't have any other BTLE device here to test. Even my phone doesn't seem to accept being a GATT server with NRFConnect....
-
Hi!
I am playing with GATT with Puck.js being a central device :var serviceUUID="2fc3af42-7a4a-1431-d1f1-fs551e3bf022"; var characteristicUUID="32160fb9-5337-4e71-b0f8-ff412e3ae078"; var MessageToSend=[0x00,0x01,0x03]; NRF.requestDevice({ filters: [{ name: Devname }] }).then(function(device) { return device.gatt.connect(); }).then(function(g) { gatt = g; console.log(gatt); console.log(gatt); console.log(gatt); console.log(gatt); return gatt.getPrimaryService(serviceUUID); }).then(function(service) { return service.getCharacteristic(characteristicUUID); }).then(function(characteristic) { return characteristic.writeValue(MessageToSend); }).then(function() { gatt.disconnect(); console.log("Done!"); });
and in the console I get :
=undefined BluetoothRemoteGATTServer { "device": BluetoothDevice { "id": "96:05:05:f7:ac:1c random", "rssi": -57, "data": new Uint8Array([2, 1, 26, 10, 255, 76, 0, 16, 5, 1, 16, 139, 101, 67]).buffer, "name": "AABBCCDD", "gatt": ... }, "connected": true } BluetoothRemoteGATTServer { "device": BluetoothDevice { "id": "96:05:05:f7:ac:1c random", "rssi": -57, "data": new Uint8Array([2, 1, 26, 10, 255, 76, 0, 16, 5, 1, 16, 139, 101, 67]).buffer, "name": "AABBCCDD", "gatt": ... }, "connected": true } BluetoothRemoteGATTServer { "device": BluetoothDevice { "id": "96:05:05:f7:ac:1c random", "rssi": -57, "data": new Uint8Array([2, 1, 26, 10, 255, 76, 0, 16, 5, 1, 16, 139, 101, 67]).buffer, "name": "AABBCCDD", "gatt": ... }, "connected": false } BluetoothRemoteGATTServer { "device": BluetoothDevice { "id": "96:05:05:f7:ac:1c random", "rssi": -57, "data": new Uint8Array([2, 1, 26, 10, 255, 76, 0, 16, 5, 1, 16, 139, 101, 67]).buffer, "name": "AABBCCDD", "gatt": ... }, "connected": false } Uncaught Error: Unhandled promise rejection: Not connected >
having a look at the
BluetoothRemoteGATTServer .connected
state, is showstrue
,true
,false
,false
. Why such a behaviour? is there really a timeout anywhere? -
-
-
-
first attempt: upgrade to 1v94 then reload same code. Result: same
second attempt: remove the bonding part in code:
var gatt; NRF.requestDevice({ filters: [{ name: 'My BT actuator name' }] }).then(function(device) { console.log("found device"); return device.gatt.connect(); }).then(function(g) { gatt = g; gatt.disconnect(); }).catch(function(e) { console.log("ERROR",e); });
And log:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v94 Copyright 2017 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate > =undefined found device ERROR Connection Timeout >
-
Hi there,
I am trying to use the Puck.js as a central device, connecting to a peripheral device (BTLE actuator).
I suppose that the procedure is as following:- NRF.requestDevice() with either
name
orid
of the peripheral device already known and used as filter - connect the gatt
- bond with
.startBonding
Whenever my Puck.js executes the
gatt.connect()
, I have 2 problems appearing: First one is that the Puck.js disconnects from the IDE, and second one is that connection fails with error "ERROR Connection Timeout".I tried to execute the code found here http://www.espruino.com/Reference#l_BluetoothRemoteGATTServer_startBonding
var gatt; NRF.requestDevice({ filters: [{ name: 'My BT actuator name' }] }).then(function(device) { console.log("found device"); return device.gatt.connect(); }).then(function(g) { gatt = g; console.log("connected"); return gatt.startBonding(); }).then(function() { console.log("bonded", gatt.getSecurityStatus()); gatt.disconnect(); }).catch(function(e) { console.log("ERROR",e); });
First step of requesting the device seems to be OK as I can read
found device
in the console when the puck.js doesn't disconnect from the IDE._____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v92 Copyright 2016 G.Williams Espruino is Open Source. Our work is supported only by sales of official boards and donations: http://espruino.com/Donate > =undefined found device ERROR Connection Timeout >
Any idea on what goes wrong?
- NRF.requestDevice() with either
-
Hi guys,
I am planning to interface my Pico with a 20x4 character OLED display OLED-020N004B from Vishay (info here: https://www.vishay.com/displays/list/product-37706/). It seems to behave like a HD44780-like display: the built-in controller is a "OLED-0010", doc here: http://docs-europe.electrocomponents.com/webdocs/1401/0900766b814011cc.pdf
This controller has the ability to interract with 6800, 8080 and SPI interface. SPI seems to be mapped on DB7(MOSI), DB6(MISO), DB5(SCK) and E(CS).
I had a look at the HD44780 module (http://www.espruino.com/modules/HD44780.js); it does not seem to support SPI mode right now.Does anyone have any idea of how I could add a
.connectSPI
method on this module? -
-
-
You could probably start playing with this module http://www.espruino.com/ST7565. If not working out of the box, it should not be too difficult to make it compatible with ST7735 chip.
In case you need help , this is a ST7735 driver from Adafruit : https://github.com/adafruit/Adafruit-ST7735-Library
-
-
-
-
I experienced many wifi connection problems with the wifi AP at home. At work, no problem. I suspect that ESP8266 may have problems connecting to certain channels or AP.
A friend of mine got exactly the same problem with its home wifi AP. We both worked with ESP01. Maybe there is a new silicon revision now?
ps: a colleague told me that this problem could potentially be seen if the quartz oscillator of the chip is slightly de-rated. A little temperature increase and the center frequency of the module is misaligned with wifi channels. I did not verify this assumption but this seems to make sense in some ways. -
Same opinion... Arduino form-factor is not very convenient... Of course there is a lot of shield out there but as soon as you plug 1 or 2 shields, you just get a big cube of PCBs and that's it. A small form factor allows for an easy integration.
The global trend right now seems to be IoT, wearables, smart things and so on. IMO the need for those trends is small battery powered connected devices. Puck.js is very well suited for wearables. However BLE is not yet suffciently established to allow people doing smart-home projects with BLE. Here comes the Espruino-Wifi.
What about outdoor projects? Is there any possibility to follow the idea of theParticle Electron
for the next Espruino board? -
-
-
You should be able to use USART1 on
D28
andD29
(see pinout )Then most of the effort is already done for SIM900 and SIM800.
-
-
-
Hi guys.
I have a case where my device is visible but I do not have any web bluetooth button appearing in theNative
IDE. Here is the console output:We have chrome.serial - not using 'serialport' module 'winnus' module not found, no Windows Bluetooth Low Energy Error: The specified module could not be found. \\?\C:\Program Files\EspruinoIDE\node_modules\winnus\build\Release\winnus.node serial_audio: Audio Sample rate : 44100 serial_audio: Audio Serial Baud 9600 Bit time 4.59375 Web Bluetooth available, but Windows Web Bluetooth is broken in <=56 - not using it GET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":"9600","BLOCKLY_EXTENSIONS":"|bluetooth|robot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS":false,"BLUETOOTH_LOW_ENERGY":true,"BOARD_JSON_URL":"http://www.espruino.com/json","CODE":"console.log(\"Hello\");","COMPILATION":true,"COMPILATION_URL":"http://www.espruino.com:32766","ENABLE_Testing":false,"ENV_ON_CONNECT":true,"FONT_SIZE":12,"MINIFICATION_DeadCode":true,"MINIFICATION_LEVEL":"","MINIFICATION_Literal":true,"MINIFICATION_Mangle":true,"MINIFICATION_Unreachable":true,"MINIFICATION_Unused":true,"MODULE_AS_FUNCTION":false,"MODULE_EXTENSIONS":".min.js|.js","MODULE_MINIFICATION_LEVEL":"ESPRIMA","MODULE_URL":"http://www.espruino.com/modules","NPM_MODULES":false,"RESET_BEFORE_SEND":true,"SAVE_ON_SEND":0,"SERIAL_AUDIO":"0","SERIAL_TCPIP":"","SERIAL_THROTTLE_SEND":false,"SET_TIME_ON_WRITE":false,"SHOW_CODE_LINK_ICON":false,"SHOW_RELOAD_ICON":false,"SHOW_WEBCAM_ICON":0,"STORE_LINE_NUMBERS":true,"Sound_Error":"","Sound_Info":"","Sound_Success":"","Sound_Warning":"","Speak_Error":false,"Speak_Info":false,"Speak_Success":false,"Speak_Warning":false,"UI_MODE":"Normal","WEB_BLUETOOTH":false} Initialising SettingsConsole Initialising Utils Initialising Config Initialising Notifications Initialising Status Initialising App Initialising File Initialising Code Initialising Serial - Initialising Serial Chrome Serial - Initialising Serial Chrome Socket - Initialising Serial Noble - Initialising Serial Audio Initialising Terminal Initialising CodeWriter Initialising Modules Initialising Env Initialising Flasher Initialising EditorBlockly Initialising EditorJavaScript Initialising Send Initialising MenuPortSelector Initialising MenuSettings Initialising MenuFlasher Initialising SettingsAbout Initialising SettingsFlasher Initialising BoardJSON Initialising VersionChecker Initialising Compiler Initialising Assembler Initialising GetGitHub Initialising NPMModules Initialising ExamplePlugin Initialising Unicode Initialising SaveOnSend Initialising Minify Initialising Tutorial Initialising Webcam Initialising FontSize Initialising UiMode Initialising URLHandler Initialising CodeLink Initialising Project Initialising Testing Initialising Notification_Sound Initialising Tern Initialising Debugger Initialising Tour Initialising SettingsProfile Initialising HelpLinks Loaded code from storage. noble starting scan Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: f8:1a:18:1b:ba:f7 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: f8:1a:18:1b:ba:f7 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: f8:1a:18:1b:ba:f7 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: f8:1a:18:1b:ba:f7 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: f8:1a:18:1b:ba:f7 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: f8:1a:18:1b:ba:f7 Found device: jpthingy f8:1a:18:1b:ba:f5 Found device: f8:1a:18:1b:ba:f7 Found device: jpthingy f8:1a:18:1b:ba:f5 noble stopping scan noble starting scan
The device is a Nordic "Thingy" based on NRF52. I don't use Puck.js because I temporarily lost it . . .
I tried with both CSR and Broadcom based BLE dongles, same result. In both cases the IDE finds the device but when I select a port, no Bluetooth port appears. Check box
Connect over Bluetooth Smart (BTLE) via 'noble'
is checked. Espruino Native IDE version is win64_0v65.9. Any idea?
I will probably try to sniff traffic but I need to order this DK before trying.
I just added
NRF.on('disconnect', function(reason) { print("Disconnected",reason);});
and guess what? never called... However the
gatt.connected
is set tofalse
after having calledSendCommandToActuator
...