-
You can also refer to http://forum.espruino.com/conversations/353421 which is similar to your issue. I would again recommend the INA219 or INA226 for voltage detection if you're not familiar with voltage dividers, because there is a big risk of you frying your device if you mess up the voltages.
At least with the INA219/INA226 they're cheap so even if you fry them they don't cost that much :P
-
Not sure if this helps, but I have a pixljs that has a large lcd so I can pipe console commands there, which is what I use for exactly the issues you face (getting feedback for operations while disconnected).
You can also try using the built-in serial instead of the BLE serial so you would free up the radio.
-
I think Gordon already mentioned this:
The MDBT42Q breakout?
Unfortunately the problem is it's connected to a voltage regulator, so it only 'sees' the regulated voltage. You'll be able to use code like that to see when the voltage starts to drop from 3.3v (meaning the LiPo voltage is near or below that), but by that time the battery is only 10% full or so.
NRF.getBattery()
measures the voltage of the immediate source, which in your case is coming from the linear regulator which would then produce 3v3 for voltages higher than 3v3 (like your lipo for example).There's also https://www.espruino.com/Tips+and+Tricks#common-issues-and-questions
How do I measure battery voltage on devices that don't have E.getBattery?
-
Even if the voltage out of the divider is 2v3 it still represents the 14v max from your power supply. The only thing you'd be missing out would be the fine grained voltage changes because the interval of 0 - 3v3 would have more values mapped to 0 - 14v as against 0 - 2v3
I personally just use whatever I have and use them so I can get a prototype running, then later on adjust the components so I can improve accuracy :P
When connecting resistors in a series for a voltage divider, I also now always triple check the location of the division. Whereas with only two resistors there's just one "junction" for the lower voltage, in a series you'd have many outputs and most of them would be far above the voltage tolerance.
-
Ah one more thing about voltage dividers, you can use resistors in a series and their resistances add up. So if for example you have a bunch of 2k resistors, you can put 4 x 2k = 8k on one side and 1 x 2k = 2k on the other side and you'll have max 2.8v from a 14v power supply.
See https://www.allaboutcircuits.com/tools/voltage-divider-calculator/
-
Following up on 1, you don't strictly need to divide to 3v3 -- you can divide to lower than that and just adjust your code accordingly. That way you can get something up and running quickly until you are able to get the required resistor values to do the 3v3 division.
I would also second the INA219 / INA226 suggestion, as those modules would do the voltage detection for you over I2C. Additional benefit is that if you happen to miswire things, the module is first in line and would probably give up the magic smoke before the pixl :P (I killed a number of INA219 modules because of reverse polarity while testing some unprotected 18650 cells).
Speaking of shields, you'll also need to be careful as many Arduino compatible shields assume 5v and may further reduce power to their components (if you wire the pixl such that 5v = 3v3) or might sink more than 3v3 on a pin (if you wire the pixl such that 5v = vin). I just set 5v to 3v3 by shorting the pads, and test the voltages with a multimeter, just to be safe.
-
This is really cool :)
I wonder if there's a way to automatically create the boot0.js etc on firmware flash? I remember that the AXP code was required for the m5stickc to not go into a bootloop, and depending on the battery level, there might not be enough time to connect with the ide and upload the battery management system.
Thanks, I'll try this one out :)
-
For the ones that are following along, here's the original post: http://forum.espruino.com/conversations/353145/
One tip though: having good discussion titles are very VERY important when asking in a forum. The one before this wasn't quite good as it doesn't immediately say what the issue was, and is likely to get ignored. This one is better, but could be improved to something like:
esp8266 I don't know how to connect to the node js server
-
-
host: 'whatdoIputhereifIamrunningalocalserverwithexpress',
Your esp and your server must be in the same network and can "see" each other (connecting to the same wifi router would be the easiest way to get this to happen).
I am not familiar with express, but you have to run your server bound to an external ip. So that way the host would be something like
192.168.0.122
instead of localhost.In order to test if your server is connectable, it might be easier to use your phone instead of the esp. On the phone browser, if you can connect to the express server via the ip address, then that's the same address you will use on the esp.
-
It depends on how you want to set it up.
You mentioned that you want to "send data" from the esp, so that means the esp would be a client that would periodically send data to your server. Alternatively you can "ask for data" from the esp, in which case the esp would be a server waiting for a request from a client.
Do you have a drawing or an image of how you're thinking of setting things up?
-
I was just gonna make something similar as well (to control some airconditioning units via IR and MQTT over wifi) and glad to know about possible issues. I didn't know ESP8266 couldn't handle some of the higher frequency carrier waves.
I've got a few ATTiby85's lying around and might want to play with those to control the stuff with strict timing requirements. Having a single "package" composed of the ESP8266 and the ATTiny85, with Espruino as the main firmware would be cool.
That might even be a nice project: being able to flash AVR chips by sending over the compiled hex files via Espruino. Just need some documentation on the wiring and the reset pulses etc.
-
Just a heads up, its out! :) https://www.chromestatus.com/features/4797798639730688 Will have to play around with this.
Thanks @Gordon for the heads up :)
-
Bluetooth over a browser uses the Web Bluetooth specification, and having the user select the bluetooth device is a security feature. Imagine you have a bluetooth device that contains information about you (like a watch) then a scammer asks you to visit a page that would try to connect to a bluetooth device around without that UI popping up.
See also https://stackoverflow.com/a/54149101
-
I'm not sure if this helps, but when I get something similar (device I'm expecting to see isn't on the list) I eventually realize it's because it's not advertising on BLE (either because it's connected and paired with something else or I disabled advertising altogether).
If you have another phone or tablet you can try the nrfconnect app and see if the app can detect the phone.
-
I have the same issues with Windows, even with a BT dongle I purchased (thinking it was because my built-in BT was too weak). On the exact same machine, if I boot into Ubuntu, the webide works flawlessly. If I forward the BT dongle to a VM in virtualbox, the VM webide works as well (but a bit slower than native Ubuntu).
I think it's just Windows being difficult. If you have a way to use a different OS, you should try it. A raspberry pi works as well (you can use the https://github.com/espruino/EspruinoHub project which also includes a hosted webide).
-
I swore off aliexpress because I've been buying too many things from it and had been clean for almost 3 months now. I blame you @fanoush for getting me back there and buying yet another gadget :P
-
Ah, it seems I can import eagle libraries into kicad with a plugin https://github.com/espruino/EspruinoBoard/blob/master/MDBT42/mdbt42.lbr I'll try this one out as well :)
-
I've been doing a project and iterating it on veroboards, and I was thinking of trying out designing a PCB for it.
I've tried searching for it, but it I wasn't able to find any libraries nor footprints for the MDBT42q breakout. Would anyone happen to have one from a project they had? Or any tips for a beginner at KiCad?
-
Just an update: it works! :)
My order for the voltage regulators from digikey just came and although I knew that they were small, I didn't expect it to be really small when not soldered to anything.
It wasn't my best soldering job as my hands are too shaky with the tight tolerances around the components, but even though I bodged it the module works again :)
-
-
-
-
I might have spoken too soon; closing and then reopening the Espruino editor gives me a memory error again:
No errors in https://raw.githubusercontent.com/espruino/EspruinoDocs/master/devices/MPU6050_DMP.js. Minifying 34114 bytes to 8589 bytes No errors. Minifying 14282 bytes to 12744 bytes > ____ _ | __|___ ___ ___ _ _|_|___ ___ | __|_ -| . | _| | | | | . | |____|___| _|_| |___|_|_|_|___| |_| espruino.com 2v06 (c) 2019 G.Williams >Resetting MPU6050... New interpreter error: LOW_MEMORY,MEMORY OTP bank is valid! Uncaught Error: Function or String not supplied! at line 1 col 353 ...r();setTimeout(e,20,a,c,g,h) ^ in function called from system
Not sure if we're talking about the same device but http://www.espruino.com/Puck.js#serial-console