Avatar for allObjects


Member since Jul 2014 • Last active Sep 2020

Espruino makes IoT as easy as 123!

Most recent activity

  • in ESP8266
    Avatar for allObjects

    hi @bk, when accessing a pin directly as you do with digitalWrite(), just take a look at the schematics/wiring and all will be clear to you. It is not what you feel is right but how the LED is wired.

    When wiring looks like in the left picture, it works like (Espruino) documented, because the Espruino boards' LEDs are wired this way. (Pin is configured - pinMode() - as 'push/pull' - "output"; 'pull - "opendrain" - will not work).

    When wiring looks like in the right picture, it works like the blue LED on the board with the ESP8266EX, since it is wired this way. Most of the time LEDs are actually wired this way, because the simplest NPN bipolar / N ...MOS... (pin) driver is implemented to work as Open Collector / Open Drain configuration. (Pin can be configured - pinMode() - either way: 'pull' - "opendrain" - or 'push/pull' - "output").

    Pics are modified from pic 'borrowed' from http://sheepdogguides.com/arduino/aht0le­d.htm (Sorry @MaBe, no Strichzeichnungen today). Any Web search of how to drive an LED will provide you with explanation. With a resistor and LED at hand you can experience both cases yourself.

    Enjoy your bright LED day...

    PS: sequence of LED and Resistor do not matter.

  • in JavaScript
    Avatar for allObjects


    the Espruino http://www.espruino.com/Bangle.js emulator https://www.espruino.com/ide/emulator.ht­ml is really a great tool to get you going: you have 5 input buttons and a 240x240 pixel color display which give you a powerful UI infrastructure, and the blinking of LEDs - the typical Espruino red LED1 and green LED2 - is emulated as red and green 'fat' dots. And the best of it: it is all integrated into the IDE, including the console, which allows to query (and modify) just everything (even) while the code is running.

    When it though comes to IoT - measuring things, controlling things and communicating - you have to get an Espruino device. The most suitable devices are the http://www.espruino.com/Pixl.js or https://www.espruino.com/WiFi. Pixl.js has a ui - display and buttons - and can communicates with Bluetooth. Espruino-WiFi can securely - https - communicate via wireless local area network with the WWW. You can also setup it up an access point to run its own wifi lan. Running a Web server - all part of the Espruino ecology - and writing a simple Web application gives you a UI in a browser.

    Having Python experience helps you for sure with JavaScript programing. Things may be called a bit different - for example ...require("moduleNameX") compares to import moduleName, but many concepts come from their 'ancestries'.

    @AkosLukacs mentioned Mozilla Developer Network https://developer.mozilla.org/en-US/docs­/Web/JavaScript. It is the the reference source. More often I though got to W3Schools https://www.w3schools.com/js/default.asp­ which includes many ready to run examples in integrated edit and run environment that you can run as is - without copy paste - and modify to explore more.

  • in Projects
    Avatar for allObjects

    The shunt (of 0.1R) looks a bit flimsy to me, but it all depends on the application. Make sure it can handle the Watts it burns or evaporates (unsolders itself). Do you know the maximum Wattage - Volts x Amps - you want consume? ...and what is the Voltage - 12 or 24 or ...?

    If you want to measure the Voltage you have to put the shunt on the high side. To exclude 'side effects' - unexplainable / wrong readings, ensure good individual connections to the 'source' - both rails - for all consumers - loads and probe(s).

    If you want to measure the real energy (Wh), you may need to use a different device: a coulomb counter (see comment at https://e2e.ti.com/support/amplifiers/f/­14/t/778625 about 'using' the INA226 for such purpose).

    Any IC manufacturer has some ICs for that.

    Regarding voltage divider and making sure the input voltage never goes below or above what PixleJS can handle, use a zener diode across the input or better a transient voltage suppressor ( https://www.allaboutcircuits.com/technic­al-articles/transient-voltage-suppressor­s-tvs-an-introduction/ ). Btw, the max that an input of a device can handle is (almost) always dependent on the supply voltage of the device. Since PixleJS can run lower as 3.3V (as the Raytac module does, which PixlJS base), you may consider this the max voltage for input in order to be on the safe side.

  • in The Place for Patreon Patrons
    Avatar for allObjects


    I'm sure you already read thru the conversation about Exploring adding setWatch/clearWatch (interrupt handling) to MCP23017 (MCP2308) Portexpander Ports
    and its related conversations.

    It's a good approach to scan only after an interrupt happened.

    Regarding the setting and reading of pins, array is of help. Unfortunately, setting pin modes has to happen pin by pin. I once had asked @Gordon to also consider the array for setting pin mode the same way as reading and writing to pins goes.

    I used similar approach - setWatch() and scanning after event - for resistive touch screen without driver (Espruino is directly driving and reading the 4 electrodes of a resistive touch screen: Resistive Touchscreen directly (no touch controller)). I later used it in the UI modules http://www.espruino.com/ui (how come is in conversation: Modular and extensible UI framework and ui elements.).

  • in Electronics
    Avatar for allObjects

    DC or AC? Shure, with DC, a MOSFET does the job, but it ties the mc power circuitry to the bulb circuitry. Using an opto driven driver triac and a load triac lets you use AC and you do not have to worry about cooling the rectifier etc... see this Arduino forum link: https://forum.arduino.cc/index.php?topic­=460187.0 and also the attached datasheet for the MOC302X series of opto driven (driver) triacs.

  • in Bangle.js
    Avatar for allObjects

    Isn't the accelerometer used to turn the Bangle.js / display on when rotating (the wrist)? Changing the interval for polling the accelerometer, does that not have an impact on that behavior?

  • in JavaScript
    Avatar for allObjects


    thank for the pictures... smart simple very space resourceful solution for the governor that controls the speed of the dial: reverse worm gear instead of small and large cog wheel.

    Do you notice irregularity in the rotation of the cam?

    Did you think of cleaning the contacts? And check the wire and (clean) other contacts in the circuit? I assume you already wend down that lane... Worst cace, get a micro switch or optical gate and catch the signal totally independent of the phone wiring.

    'Related' question: what do you do for hand set (microphone and ear piece)?

    Looking forward to your solution. I have some phone hardware laying around for a while now. When the project was hot and I had ordered as A6C Quad Band on a breakout board, I got instead sent just the module... and by the time the other options arrived, the need was not pressing anymore, so the stuff still 'waits' for some time to squash - squander? - The A6C then arrived w/ a camera w/ flash, and the SIM800L is with PCB antenna.

  • in General
    Avatar for allObjects

    Great. Thanks for the fix and feedback.

  • in General
    Avatar for allObjects

    Picking a Pico from my stash of Espruino boards, I picked a 1v92 flashed one... what a great release this was, like the 1v96. Updated to 2.v06 and for obvious reason and curiosity I noticed two things:

    1. The image selection dialog pop-up looks not that user friendly (anymore): the width is too narrow to show the drop-down box arrow. Some image short description text is so long that user has to scroll top the far right to get to it. Not a big deal, but is just not looking confidence fostering (see attached screenshot).

    2. For curiosity, I checked / compared process.memory():

      • 1v92 shows nice JSON in console
      • 2v06 shows something mixed
        Where is the difference coming from?


    >process.memory()  // 1v92
    ={ "free": 5076, "usage": 24, "total": 5100, "history": 9,
      "stackEndAddress": 536958124,
      "flash_start": 134217728, "flash_binary_end": 376720,
      "flash_code_start": 134234112, "flash_length": 393216 }


    >process.memory() // 2v06
    ={ free: 5076, usage: 24, total: 5100, history: 7,
      gc: 0, gctime: 5.54466247558, blocksize: 16,
      "stackEndAddress": 536958184,
      flash_start: 134217728, "flash_binary_end": 386528,
      "flash_code_start": 134234112, flash_length: 393216 }