Most recent activity
-
-
Have you connected anything to serial pin (D0 on MDBT40Q)? That would turn on the high speed oscillator and increase power draw.
Also, are you connected via BLE (or any phone or computer that may connect automatically)? You have to disconnect to actually shut off radio. -
-
I'm trying to write 16bit integers to a file, but didn't got the result I was expecting. For example:
>var d = new Uint16Array([255, 1111, 42]) =new Uint16Array([255, 1111, 42]) >d[0] =255 >d[1] =1111 >d[2] =42 >fs.appendFile("log0.txt", d) =true >var dr = fs.readFile("log0.txt") ="\xFFW*" >dr.charCodeAt(0) =255 >dr.charCodeAt(1) =87 >dr.charCodeAt(2) =42
\xFF
is 255, ok for one byte.
1111
is0100 0101 0111
in binary, andW
is 87 character code,0101 0111
binary. Looks like the lower byte of the 16 bit integer is saved.
*
is 42, ok.My question is: Looks like saving typed arrays directly is not supported. Will it be, or what would be the best way to save this data as fast and efficient as possible?
Board is a Pixl running 2v08.188 (and of course shouldn't call a binary file
.txt
) -
-
- 3 comments
- 61 views
-
-
Is there any way to get OneWire and BLE reliably work together?
Using a Pixl with 2v08.188, have three DS18B20 attached to A0. If Bluetooth is connected, mostly only 0 or 1 sensor are detected, and there are a bunch ofnull
values returned when reading temperature.
Tested with Pixl on serial, and with an Espruino Wifi, and all sensors are detected, and almost nonull
values returned.If I'm right, OneWire is done in software, and I assume BLE communication is interfering with that, right? Is there anything that could improve? Do the coding, and disconnect & disable BLE to run the code?
And other question: Assuming I'm not using BLE while running the code, what are my chances of reading multiple DS18B20 and reading accelerometer and writing to SD card together? Ok, let's just try it :D
Code is below:
var ow = new OneWire(A0); //R: VCC, G: Gnd, Y: Data var sensors = []; function scan(){ sensors = ow.search().map(function (device) { return require("DS18B20").connect(ow, device);}); } setInterval(function() { sensors.forEach(function (sensor, index) { sensor.getTemp(function (temp) { console.log(index, sensor.sCode, ": " + temp + "°C"); }); }); }, 1000); setTimeout(scan, 1234);
Interesting, IIRC Espruino interpreter does "wake up" periodically, some timer runs out, it's documented somewhere. So short spikes in power consumption is expected.
Tested with an MDBT42Q breakout @ v.2v08.189, but my baseline is around 5~7uA (measured by an INA226 and Espruino) .
When did you buy the Espruino and the Raytac module? Long shot, but maybe Raytac changed something in the module, and doesn't go as low power as earlier modules did? Got mine with the Bangle kickstarter. Or maybe you uploaded something earlier to the modules that changed fuse bits?