-
I have seen it since i am fiddling with the serial connection, but so far no reliable way to get it yet. I also just upgraded to 1.93 154.
I lose the console connection. When I try to reconnect the computer to the Puck it gives me the lights and windows asks me to try again.
the code doesn't do much special,
//turn off serial connection digitalWrite(D28,0); digitalWrite(D29,0); console.log("Turned off serial connection!"); //provide Serial ground and V digitalWrite(D30,0); digitalWrite(D31,1); // Connect to serial device Serial1.setup(115200, { rx: D29, tx : D28 }); var ATSMS = require("ATSMS"); var sms = new ATSMS(Serial1); //Use sms.at.debug(); here if you want debug messages sms.init(function(err) { if (err) throw err; console.log("Initialised!"); // and to send a message: //sms.send('012345678','Hello me!'); });
-
-
-
-
-
The battery was already at half I would say. Guess the findDevices is something to do sporadically.
Do I understand correctly that setting the advertising doesn't cost as much battery as does findDevices? Advertising is limited to once every 315ms or something, while findDevices is a constant operation?
-
I have seen it do a restart. When I had the program saved it ended up stuck in the end. Without anything saved it came back up with its original 'Puck.js a000' bluetooth name!
Could that mean the battery is being depleted and coming back up after a while? I see the battery measure going down reasonably fast, enough to reach zero in a 6-8 hours.
Later on battery levels show higher levels again. Does setting Bluetooth search and advertising take that much battery? More than the cell can deliver constantly. That wouldn't be too bad as it is doing the check every 4 seconds now, could be every 4 hours later...
Will upgrade the firmware and set it off running now.
Nothing wrong in my code, now that is unexpected :)
-
Very nice!
Of course my first line of defense should be proper programming on my side. I really didn't want to do this (show my beginner programming..) but somehow this code below makes my Puck restart within a day. Driving me nuts..
Basically a guarding program that check for the absence of light and the presence of a magnet. It puts the result in the bluetooth name. There is an extra feature that checks for the presence of a bluetooth name 'base'. At the moment it just adds a ">" to the front when it isn't there, eventually it should do a NRF.sleep() when it is out of reach of the base to save battery.
It sets a message "LM:LM", the first two tell whether it has seen light or lost the magnet during the running time of the puck, the second pair shows whether it sees light now or whether the magnet is absent right now. Good news would be "--:--". (It also adds the time, free memory and battery for debugging.)
I am assuming something is wrong with the function notifyBase(statusMessage), where I look for the base and set the advertisement. It is asynchronous I know that, is it being run on top of itself maybe, should I be catching errors?
var firstLightAlarm; //keep track of whether there has been a light alarm var firstMagnetAlarm; //keep track of whether there has been a magnet alarm var timeStart, timeNow; clearWatch(); // just to make sure I don't keep stacking watches and intervals clearInterval(); //check for light(light>.2) or loss of magnet (strength<10000) function doCheck() { var lightLevel = Puck.light(); var seeLight = lightLevel > 0.2; var mag = Puck.mag(); var magForce = Math.sqrt(mag.x * mag.x + mag.y * mag.y + mag.z * mag.z ); var lostMagnet = magForce !== 0 && magForce < 10000; statusMessage = setStatus(seeLight, lightLevel, lostMagnet, magForce); notifyBase(statusMessage); // go set the advertisement as statusMessage } // construct a status message out of sensor values, history, time. //LM:L- means "Seen light and lost magnet in the past, at the moment seeing light, but have the magnet close. function setStatus(seeLight,lightLevel,lostMagnet,magForce) { var statusMessage; var secondsRunning = Math.floor(getTime() - timeStart); firstLightAlarm = firstLightAlarm || seeLight; firstMagnetAlarm = firstMagnetAlarm || lostMagnet; statusMessage = (firstLightAlarm ? "L" : "-") + (firstMagnetAlarm ? "M" : "-") + ":" + (seeLight ? "L" : "-") + (lostMagnet ? "M " : "- ") + "T=" + Math.floor(secondsRunning/(60))+ //minutes since initialization //" L="+Math.floor(lightLevel * 500)+ //" M="+Math.floor(magForce/100) + " "+ //watch out for growing string error " B="+Puck.getBatteryPercentage()+ " FR=" + process.memory().free; console.log(statusMessage); return statusMessage; } // Set BLE advertisement if 'base' present. When base not present Puck would normally stop advertising It now just adds a > in front of the status. function notifyBase(statusMessage){ NRF.findDevices(function(devices){ var foundBase=false; for (var i = 0; i < devices.length; i++){ var name = devices[i].name; if( name == "base"){ foundBase= true; break;} } if (foundBase){NRF.setAdvertising({},{name:statusMessage});} else {NRF.setAdvertising({},{name:">" + statusMessage});} //temporary, without base it should stay quiet },1000); } //main program, sets the 4s interval to do a check function onInit() { firstLightAlarm = false; firstMagnetAlarm = false; timeStart = getTime(); digitalPulse(LED1,1,100); clearInterval(); // otherwise you run out of memory on many button presses setTimeout(function(){ setInterval(function(){doCheck();}, 4000); },2000); // 2s timout to place Puck without triggering early alarm } //click button to re-initialise. setWatch( function () { onInit();}, BTN, { repeat:true, edge:'falling', debounce : 50 } ); onInit();
-
-
I have a GSM800 module that is only to send one sms per day. It has its own battery and is turned on and off by mosfet and a output pin.
I am reading you don't get a Serial port if nothing is connected at startup to D29/29 on the Puck..Does this mean the serial port must stay active using the oscillator the whole day, or can I turn it on and off at will?
Thanks
-
Love it, either that or a I2C voltage meter like this:
http://alexnld.com/product/cjmcu-219-ina219-i2c-bi-directional-current-power-monitor-sensor-module/ -
-
-
-
I am letting a program run for a long time on the Puck, but somehow it stopped after a day.
It is showing light and magnet level in the bluetooth name, changing every 4 seconds.
But it stopped after a day. Battery level was at 72 so ought to be fine.
It did have a Console.log in it, does that get saved when not connected to the IDE and maybe did the memory get full? I couldn't connect at all anymore, had to do a hard reset where i insert the battery while holding the button, 5 green blinks.
Something else that might be leaking memory or something? It is a pretty simple loop.
-
-
-
-
Is there a way to get the response back in the console when i send an AT command?
second,
The AT+POWD=1 command is problematic, it turns the phone off, but after ten seconds it automatically restarts.
Is there an easy way to 'physically' take the 5v off off the SIM800 controlled by the Puck? The Sim800 needs 5v with up to 2 amps so can't get power from the Puck itself right.
-
-
-
Well, I said I was a beginner.
When you stick a pin in the Puck it makes a proper connection. But with the BMP280 it makes no connection at all. Or worse, some do and some don't.
Getting myself a proper board to fiddle, and soldering on pins is probably not a bad idea either :)
Thanks for the help anyway, much appreciated.
-
The code, with
D30 at 0 connected to SDO and
D31 at 1 connected to CSB.digitalWrite(D30,0); digitalWrite(D31,1); var i2c = new I2C(); i2c.setup({scl:D2,sda:D1}); var bme = require("BMP280").connect(i2c); console.log(bme.getData()); setInterval("console.log(bme.getData())",1000);
giving me the same figures as if nothing was connected:
_____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |_____|___| _|_| |___|_|_|_|___| |_| http://espruino.com 1v93 Copyright 2016 G.Williams >{ "temp": -0.00000017881, "pressure": 0.01541300212 } =undefined { "temp": -0.00000017881, "pressure": 0.01541300212 } { "temp": -0.00000017881, "pressure": 0.01541300212 } { "temp": -0.00000017881, "pressure": 0.01541300212 } { "temp": -0.00000017881, "pressure": 0.01541300212 } { "temp": -0.00000017881, "pressure": 0.01541300212 } { "temp": -0.00000017881, "pressure": 0.01541300212 } >reset(); =undefined
I don't see where I am different from the BMP280 module page ...
I was checking with a buzzer and i do see that the beep coming from 3v and GND off the Puck is a lot stronger than the D30 D31 combination, kinda weak.. but that may be normal
I had to go back to 1.93,