-
Does this provide some insight:
"Example code for the "Chirp" soil moisture sensor"http://forum.espruino.com/conversations/270246/#comment13634478
http://www.espruino.com/simple_data_logger
http://www.espruino.com/Tutorials -
Does this post provide some insight http://forum.espruino.com/comments/13622029/
Could you elaborate on how much of an 'exact distance' you are expecting to achieve?
-
Thank you @allObjects for clearing that up. I liked your concise explanation within the pp detail on battery differences.
Did you mean 100..2100ma to be 2.1A and not 1.2 as indicated?
I was surprised to learn that my PC had a USB3 port along with the USB2 ports. The 500ma value has a bit of latitude when on a USB3 port. 900 big ones!
https://en.wikipedia.org/wiki/USB_3.0
"As with earlier versions of USB, USB 3.0 provides power at 5 volts nominal. The available current for low-power (one unit load) SuperSpeed devices is 150 mA, an increase from the 100 mA defined in USB 2.0. For high-power SuperSpeed devices, the limit is six unit loads or 900 mA (4.5 watts), almost twice USB 2.0's 500 mA"
For what it's worth, I've not had an issue, yet, . . . running WiFi over USB2/USB3, but I heed your warning. That said, I chose to power my little critters with an external supply, lest I suffer the wrath of extra electrons wanting to take an undesired path while I'm on a productive breadboard design streak.
-
Sun 2017.05.14
Hello @Thinkscape,
Although I have no experience with the WiFi version;
I'll agree with you the documentation could be improved with this bit of detail. Do you currently have the WiFI board, or are you considering a purchase?
Have you checked out these resources:
http://www.espruino.com/WiFiNote the section in red, just below 'Pins not on connectors'
So, it appears that 3.3v could be supplied to pin J2-3 , Gnd to J2-1 , rather than and instead of powering via the micro USB
See EDIT below
This would mean of course, tack soldering your JST connector choice to the top of the header pins.
Schematic:
https://github.com/espruino/EspruinoBoard/blob/master/WiFi/pdf/espruino_wifi_sch.pdfNote: The schematic shows both VBUS and VUSB All text documents refer to VUSB Not sure if this was intentional, or just to differentiate between power in via the connector VBUS and that used to supply circuits on the board itself VUSB.
This detail should suffice in the meantime until another with actual hands-on experience can assist here.
Robin
EDIT:
From the bullet list just below 'Pinout'
"3.3 is a 3.3v output from the on-board Voltage regulator."
Although this pin is on the downside of the regulator, there isn't any reason schematically this couldn't be used as a supply pin. However, just now locating this comment, leaves me with a bit of doubt, as it is specified as an output pin. So, not sure if my suggestion to tack solder a connector here is prudent.
Maybe, J2-2 labeled VBUS (on schematic VUSB on diagram) could be used as long as the battery supply is above the voltage regulator input requirement.
"On-board 3.3v 250mA voltage regulator, accepts voltages from 3.5v to 5v"
-
Would this tutorial (with modification) solve the BLE in range detection?
-
Thought that https://translate.google.com/ would help here:
Distance measurement and signal tone with puck.js
Hello,
My name is Jonathan and unfortunately I hardly know with microcontroler. I need however one of the exactly the below mentioned requirements met, would not like an exact instructions or a finished product but just like to know which modules I could use around so ittusetzen. As a basic building block I have thought of a puck.js. Here, the design, the single button and the transmission via Bluetooth is already very much and thus unites many of my requirements.
The distance measurement is the most worrying to me.I also asked if you can estimate the signal strength of a Bluetooth signal to the approximate distance.
Conditions:
Distance measurement on the other "similar" microcontrolers (maximum 3 m tolerance) maximum distance to be measured are 40 m
-It must be possible to output a signal tone
(A switch with I / O would be long, functions with "double-click" or "long hold" would be better)
-programmable for grinding, timer Ect.
Devices must communicate with each other on at least 50 m and exchange data, or control the other device. (Access to LED s or signal from the other device)
-The battery / battery life must be longer than 3 days a 20hHow it works:
2 devices connect sorfort when they are within range and measure from about 40m constantly the distance to each other. When a push button is pressed on one of the two devices, a signal tone is heard on the other device when it is at a distance of 25 m from the other device. In addition, a 10 sec. Timer. If there is still 10 seconds below 25 m, there should be another signal tone. If the push button is not under 25 m, this is indicated by the LED s on the device that was pressed. It should go in all directions on both should the siganlton be sounded when the other is pressed.
It is not a must but it would be nice if the whole then synonymous with 3 or more participants functions. For all devices within a radius of less than 30m, the signal tone is sounded or only at the next.The price should not exceed 200 € per device.
Many thanks in advance
Greeting Jonathan -
Sat 2017.04.15
Although my experience is with the Pico, my guess is that any GPIO pin will work. The software function you are after is digitalRead() http://www.espruino.com/Reference#l__global_digitalRead
Use this tutorial to garner insight. Wire Loop Game
One wire to ground. The other through a 10K to the GPIO pin. Or rely on the internal pull-up.
-
Mon 2017.04.10
@user75617
Hi Spocki - I've read that - not sure of the relevance of it to the issues I've mentioned above.
and
So firstly - the terminal keeps throwing back "undefined"
After a quick review, I'm with @Spocki and @Ollie that everything is as it should be.
Ollie has pointed out the coding omission.
Spocki may have been referring to https://www.espruino.com/FAQ for the explanation of 'undefined' See heading: "When I type a command, why does Espruino print '=undefined'?"
9600 is the default when connecting over USB-TTL prior to flashing
https://www.espruino.com/Troubleshooting115200 is the rate after initial flashing
http://www.espruino.com/ESP8266_FlashingThe WebIDE also has this statement under heading 'Baud Rate' within the settings option.
WebIDE >> Settings >> Communications >> Baud RateAlso - this - in the docs - is unrecognised. ESP8266.getFreeFlash()
Beneath Heading "ESP8266 Library" https://www.espruino.com/Reference#software getFreeFlash()
As Ollie points out, the missing inclusion.At times I thought there were mysterious errors creeping in. I discovered that taking a bit of extra time to comprehend the reading material was all that it took. The above links should be re-visited.
-
Have you attempted this tutorial yet?
http://www.espruino.com/Individually+Addressable+LEDsIt has a fading effect between colors, similar to that which you might be seeking.
@Gordon has spent a considerable amount of his valuable time coding a framework for you to hang your work on. It would be prudent to blend the above tutorial example into your work to get the desired effect you are after.
It is difficult for anyone to write a solution to an idea you have firmly cemented in your mind. A bit of study should provide the insight to a solution to that which you envision. I'm sure you will be proud of your own effort once you achieve success.
“There are no secrets to success. It is the result of preparation, hard work and learning from failure.” - Colin Powell
-
Sun 2017.03.19
you could put Puck.js in one sock, and a magnet in the other - then you could use the magnetometer to detect roughly where one foot was in relation to the other
Keep that in mind @Gordon for the next Live Demo - would have been nice for a hands free operation and instant Ah-Ha! 'gotta get one' moment video ~19:05 forum post #6
-
Sun 2017.03.19
'minification' in settings (the first item) is supposed to say 'No Minification' and I bet it doesn't.
in reference to the brash 'I bet it doesn't' verbage along with verbose specific recommendations in forum post 'Blackjack Secret Card Counter'
Oh nooo! @Gordon you are not giving up on Espruino to explore your new passion of gambling, are you?? ;-)
Kidding aside, it is good to know you were able to duplicate and identify what was going on, and also presume what the cause was, filing the bug report indicating such. Knowledge and experience does go along way, doesn't it.
Although I never intentionally set options under the minification settings, however I did check, but have no explanation for why the option 'Esprima (Offline)' was enabled and not the default as you indicated.
Sun spots, aliens, intruders, the neighbor, late nights coding, mornings without coffee?
Insert sponsor advertisement and marketing hype here
A morning without coffee? Try Espruino brand coffee. Ooooh, I smell additional revenue stream. . . .
Yes you heard it here first, a sample packet of the Espruino blend and mug with every official board purchased!
[Off Soapbox]
It's possible I fiddled with this on the day of installation, and never really put back how I remembered the defaults to be. More likely a window covering the WebIDE was being clicked on, and as Windows has that nasty habit of delaying click recognition, passed the click through to the WebIDE, even though the covering window hadn't been dismissed yet. Can't tell you how many times I've been burned by that anomaly. Note to self: Put Cray XT5 on X-Mas list
Still befuddled with: 1700 * 16 = 27200 bytes I get the simple math.
It's because 12288 is the amount of Flash, but you have more RAM available. At >1024 vars it's 16 bytes a var, so 1700 * 16 = 27200 bytes.
Maybe a better question would have been, why isn't the remainder more in line with a common 2n multiple? When sending code, the internal methods use the 1024 boundary which is 4 0xFF a nice computer number but 27200 seems so clumsy, it doesn't seem to have as nice an explanation. 256*128=32768 is too large and 256*64=16384 too small. 27200 hummmmmmm?
Thank you Gordon, for staying with this until completion. I know this has been a bit drawn out when there is so much else that requires your expertise.
I know others will appreciate your explanation as it gives a good analysis of what is going on under the hood.
Robin -
Yes I need power from external source: the puck.js uses it's battery for it's own use, while the external power comes from somewhere else.
As the need to power from an external source, wouldn't the inclusion of a regulator offset the cost of of powering the Puck via a CR2032?
Unless of course the NeoPixel battery requirement isn't above the regulator input.
-
Sun 2017.03.19
Hello Owen,
I have been following along since project inception and I am as excited as your daughter will be once this ornament is glowing, especially in the dark!!Just to be 100% and as I am ill with one hell of a cold, NeoPixel signal: what is the preferred output pin?
Although your discourse hasn't included the extent of your background in electronics or programming, forgive me if the following sounds audacious. also, . . . hope you are feeling better.
There isn't an indication as to whether the NeoPixel(s) has been fired up yet, (I see the wood rings have been though) ;-)
I blindly followed the example tutorial code on both a Pico and an ESP8266 with no regard to output pin selection, just changing the code to represent which pin the NeoPixel data pin was wired to, and had no issue. The device and NeoPixel have been running for two weeks solid and no smoke yet. ;-)
Now, with that said, the NeoPixel is a power hog. Will you be notifying the power company before you fire this up?
I wired mine through a separate wall-wort with a 3.3v regulator for the ESP8266. But I see 61 NeoPixels, which will pull over an amp just with basic code fiddling. Don't believe the Puck will keep up with that demand, definitely not with a CR2032. If the code requires constant white with all on, expect stuff to get quite warm. (20ma * 3 colors ea NeoPixel)
Discovered this tidbit:
PICO: 25mA by pin, but not more than 120mA for all pins together. forum post
My guess is that the decision for a separate supply has already been discovered as only around 5 or 6 LEDs can be powered directly from the Puck itself, any Espruino board for that matter.
Hope the soldering part is going well and can't wait for the animated video . . . .
Robin -
ref allObjects
puck needs also a fanshonable - non-geek / non-engineer - casing
ref Gordon
I wonder if it's literally just a Bluetooth microphone that sends the audio to your phone though?
(About 20% down web page #1)
"Senstone is a standalone device so you can take notes and create lists when its not connected to your smartphone. It records for up to two and a half hours when offline. Then it automatically syncs your notes in the cloud when you are back in range."ref OwenBrotherwood
So only software is interesting? (and the model in the above picture)
Puck'er up!
Couldn't resist . . . .
-
Mon 2017.03.13
Thank you for running tests on your boards. It's unfortunate that duplicating my experience didn't occur.
are you running with minification turned on
I haven't made any changes to the WebIDE settings for any of the examples. (for minification - left factory defaults as is - yes?)
ref:
//this is the problem section
I left this comment intact to avoid adding more confusion when removing lines of code. The comment actually refers to the commented out block that follows, there was an unresolved issue decoding the unknown JSON object that is returned from wifi.scan()
"You're saying you upload code20170206ESP8266FileServer.jsSTART.js exactly as it is, and then remove:"
Yes, with clarification.
I removed around 3K-4K of bytes each time, around ten times more than indicated above, both code and external comments. I was also jumping around seeking sections to remove, so this might be a contributing factor. e.g. whitespace
The only way to tell exactly what was removed would be to compare side by side with software that could detect the changes.
When I was able to duplicate this increase, I created the file 'NotesGordon20170224.txt' and appended the steps in chronological order.
I indicated (the best I could as a text file isn't the best here) which file, brief list of areas I removed code, the WebIDE process.memory()
output, followed by the saved bytes resolution, renamed and saved the file, then repeated the process. I did all the editing in the WebIDECould it be that ver 1v89 is problematic here?
I never was able to resolve why I couldn't flash 1v91 on this ESP8266-12 so I'm stuck at 1v89 ref: 'save() on espruino_1v91.122_esp8266 results in immediate Disconnected prompt'Note that I never did test on my Pico as I was working with wifi and EspruinoWifi was not available from suppliers here in the USA.
I'm not seeking a solution to the limited space issue nor am I seeking help in resolving coding issues. It's unfortunate that what happens on
my PC isn't being duplicated. I note that we are working with a different board and different software version.Still wondering if not being able to flash is related to the save() disconnect issues others have had with the puck and this weird anomaly when using large file sizes. If this has become too much a time sink, then maybe we should just shelve this for now and see if others ever have similar issues. I felt it important to document for the reasons above and the fact it is repeatable.
EDIT: After several hours of mulling this over I realize the following:
Point 1
In each test case above, a complete new file was loaded into the WebIDE before a transfer via 'Send to Espruino' button press.In my case, I used one file and reduced that, never reloading a fresh data set. Although the original file is gone, I started with a file that executed as expected, taking up one half the destination space of around 800 jsvar blocks. I inserted a 4K char chunk of function code towards the end of the file. This caused the error
Uncaught SyntaxError: Got UNFINISHED STRING expected EOF at line 1 col 8640
I started to remove unneeded comments and functions totaling around 4K chars each attempt. Then saved that result to a file, those that are included above.
Note that I'm always using the same file in the WebIDE memory space.Point 2
The available size on the 1v91 test above is much larger and compresses to a much larger result ~30000 vs ~10000
The difference using an Espruino board vs an ESP8266-12>process.memory().usage =1311 Compressed 81600 bytes to 30856
vs
>process.memory() ={ "free": 482, "usage": 1218, "total": 1700, "history": 431 } ERROR: Too big to save to flash (16445 vs 12284 bytes) Compressed 27200 bytes to 11884
-
-
Sun 2017.03.05
@user73202
I've tried a lot of times, everything I found online and what you told me to do. nothing works.
What is meant by "I've tried a lot of times" . . . . "what you told me to do"?
Are you referring to the process of re-flashing or the removal of solder from the bridged solder pads?
Has the solder bridge been removed?
Is it possible that the correct BTN1 is being pressed and held with a tap on RST, but incorrect orientation may have them reversed? http://www.espruino.com/EspruinoBoard
Do the Blu and Red LEDs flash at all after the release of RST? http://www.espruino.com/Troubleshooting
-
Fri 2017.03.03
While you are patiently waiting for your shipment:
From #1
I don;t have a solder wick or pump at hand.
Another technique you might consider, is this that I use when in a pinch, . . . when a solderpult is not available.
Lay some newspaper out to catch the solder splash. Wear eye protection. Heat your iron while reviewing the following:
It is possible with a little practice, to get rid of the solder blob by holding the board firmly in one hand, such that the solder side is facing downward and at a 45 degree angle to the table top. Raise the arm holding the board around six inches in the air. Heat the bridged pins with the iron and as soon as the solder liquifies, no more than one second after, slam your arm onto the table, keeping your wrist locked such that the board doesn't contact the table. The molten solder will keep moving towards the table as the board stops moving. Your arm is absorbing the shock as it stops the movement. When done correctly, you'll splatter the newsprint covering the table with that blob you were attempting to get rid of.
Practice the movement several times before heating the pins. As a word of caution, too many heat and re-heat attempts may delaminate the pads from the board, or ruin the chips themselves, so only do this as a last resort.
If you have never done this previously, it might make sense to mask off the other pins, so that no solder splash ends up on other pins making matters worse. Also, put down several sheets of newspaper so as not to damage anything else. Remember it takes a few seconds for the solder to cool, so it will attempt to attach to whatever it comes in contact with. Most of the blob will cool on the newsprint making a really cool frozen-in-time splat. Brings back memories of the solder blob wars we used to have, flinging blobs of solder at each other. Loads of fun, but a stupid idea, . . . but I digress. [Do not try this yourself - although I know some readers might]
From #5
Can you give me the link for a good USB-TTL converter
So that those of us, that have access to other resources may provide you with other relevant possibilities, and are close to you for shipping/handling reasons, what country, continent, time zone are you located?
Hope these ideas help . . .
-
If you get some code that exhibits the behaviour post it up and I'll check it out.
Although I wasn't able to duplicate the 500+ byte save() increases that occurred when deleting 4K chunks of source, I was able to capture a 248 byte increase example.
In order not to muddy this thread with massive source code image blocks, I'm providing it here in five files.
Increase occurs between file PASS1 and PASS2 after the removal of both internal comments and wrapper functions.
Although this is of low priority, one might find some devious gotcha's lurking about. Would love to hear your findings, even if by email.
Robin
-
Thank you for the detailed explanation.
you can only join to one at the time
I'm going to need to read up on networking as my understanding is a bit flawed. This also presents a snafu with my overall project idea, that the end user will need two connections and a bit more than a basic understanding, so the feasibility is now in question.
Will be taking a break to do that research. Thanks for the exchange this evening, it has been quite enjoyable.
-
Simple answer, yes
Take a smart phone, connect to the ESP APs and open a browser to connect to 192.168.4.1
What is the process of 'connect to the ESP AP'
Isn't the browser doing just that when we type 192.168.4.1 into the addr field and hit CR?
Aren't we doing that task as in the code snippet from post #16 above? e.g. isn't the station
binding to the ap when we use wifi.connect() and we see "mode": "sta+ap" -
Amazing this Internet thing, how we are able to have near instant communication while 3000+ mi apart!
It must be getting late for you so I'll attempt to wrap up.
Sorry, but what are you trying to achieve ?
I must brush up on my German as apparently I'm not getting my point across. ;-)
I tried to explain that in post #10 above, I'll give it another shot.I'd like my IoT device to power up in a state where the user need only type 192.168.4.1 into the browser to gain access to a web page that would enable them to enter their ssid and p/w to gain access.
I attmepted the JoinWifi.js example you created, but could only get a web page to render after I had viewed the router settings 192.168.1.254 and visually acquired the IP in order to enter that into the browser. Trying 192.168.4.1 was futile. It will be near impossible to provide simple connect instructions to users that most likely wont have a clue about router IP settings, nor how to diagnose. Look at the issues I'm having, despite having a bit of a clue as to how to continue.
My problems were compounded by the fact the IoT device is not connected to the PC via wifi directly. It is actually connecting via the router as indicated by the failed tracrt report. That gave me the clue that maybe my TV configured router may have the default ap mode disabled. No clue why I didn't think of that a week ago despite everyone indicating that 192.168.4.1 is a known ap default.
Could the stations array [ ] be a feature completed after 1v89 ?
Still, with all the progress today, still am unable to connect via the browser. Maybe a reboot is now required.
Thank you for your continuing assistance.
Robin -
Ah, good point Mark,
Even though I'm getting a 'connected' reply using the snippet above, the stations array is still
empty [ ] implying what you just indicated. Is there another trick in resolving how to join?
The snippet above is very similar to the joinWifi() function in the source you created.In case our posts crossed, after a static router config I am now able to ping 192.168.4.1 through a cmd window, however browser still wont connect. Is there a ping equiv using the WebIDE?
Incidentally, thank you for staying responsive while I test. I'm in the CST time zone in the USA, where are you located?
-
Big clue,
If I use:
setTimeout(function(){wifi.startAP(C.SSID,null, function(err){ wifi.connect("2WIRE113", {password: "3321205212"}, function(err){ if(err)console.log(err); else console.log("connected!"); }); } ); },700);
such that I have the sta config along with the ap
wifi.getStatus() { "mode": "sta+ap", "station": "connected", "ap": "enabled", "phy": "11n", "powersave": "none", "savedMode": "off" } wifi.getIP() { "ip": "192.168.1.71", "netmask": "255.255.255.0", "gw": "192.168.1.254", "mac": "5c:cf:7f:88:f4:a0" } wifi.getAPIP() { "ip": "192.168.4.1", "netmask": "255.255.255.0", "gw": "192.168.4.1", "mac": "5e:cf:7f:88:f4:a0" } wifi.getAPDetails() { "status": "enabled", "authMode": "open", "hidden": false, "maxConn": 4, "ssid": "ESP_88F4A0", "password": "", "savedSsid": null, "stations": [ ] }
now, I'm not able to ping 192.168.4.1 'Request timed out' which explains why the browser won't connect. Can ping 192.168.1.71
Now the big question, why am I not able to ping?
No proxy enabled, Firewall off and disabled virus scan. Points to Windows 10 to me.
Also tried tracert
C:\Users\Robin>tracert -h 3 192.168.4.1
Tracing route to 192.168.4.1 over a maximum of 3 hops
1 2 ms 3 ms 7 ms homeportal [192.168.1.254]
2 * * * Request timed out.
3 * * * Request timed out.Trace complete.
Edit Sat 2017.02.25
Getting closer. For those on a 2Wire ATT UVerse gateway/router - (likely USA)
https://forums.att.com/t5/AT-T-Internet-Equipment/Static-IP-Setup-3600-3800-3801/td-p/3607065setup a static IP address of 192.168.4.1
Now I am able to ping the ap and the sta, but still am unable to access via a browser page.
Maybe that will be cured with a Windows 10 reboot. Will have to wait for that . . . .
Mon 2017.05.15
It is good that you are asking the right questions and I'm sure you will be excited making the correct IoT choice. Supporting @Gordon with an Espruino brand IoT board purchase would be appreciated.
You are correct @Thinkscape under certain conditions. I believe it was @Gordon that covered this in a post I am still trying to locate. I'll do my best to summarize until that link is found.
The idea is to run the device on a 1% duty cycle running at the 20ua drain 99% of the time. These devices consume around 50ma to wake up, 100ma at impulse for mild number crunching, 200ma during warp drive, and up to 500+ma using WiFi etc. The GPIO pins can source around 25ma but the total chip source is only around 100ma for all IO out meaning around five LEDs at 20ma each. As one can see, during excessive WiFi use, an external (wall-wort) power source is recommended to save on battery draw.
Still seeking that link,
Robin
ESP8266 - NodeMCU - led and ds1820 temperature example
http://www.espruino.com/Wireless+Temperature+Sensor
http://www.espruino.com/Tutorials
EDIT Mon 2017.05.15
Still searching for that post but did find the following:
@allObjects posted the chip GPIO data:
'maximum current from the espruino pins'
http://forum.espruino.com/conversations/280779/#comment12746768
See p.59:
http://www.espruino.com/datasheets/STM32F401xD.pdf