yet-another-intercom-hack

Posted on
Page
of 2
Prev
/ 2
  • Yep, those batteries look good.

    still_waiting_for_more_infos

    Yeah, was that in the SIM900 driver? It was some contributed code and I ended up buying two SIM900 modules that don't work in the UK, so I haven't been able to test it out properly!

    SMS

    If you do a google search for site:forum.espruino.com sms you'll find some code people have used for this in the past.

    Now there's the AT library it should be a bit easier too.

    When you do the SMS stuff, it'd be really good if you could put it up as a module - it'd be really useful for loads of people I reckon.

  • Hi there !

    Sorry for the delay, 'didn't have time to do personal stuff recently ( .. )

    for the

    still_waiting_for_more_infos

    stuff, I got it from http://www.espruino.com/AT

    Concerning the modules you bought, I'm sorry to hear you didn't get those to work using the link provided on the SIM900 module page :/
    ( I did also purchase one SIM900 module while getting those cheap SIM800L, but I didn't take time to test it, although I was & still am quite interested in the tts capability available on those .. and not, sadly, on the SIM800L .. )

    Whenever I'm back to interfacing the SIM800L with Espruino, I'll post updates on this thread & also on https://github.com/stephaneAG/SIM800L#es­pruino-sim800l-module-api

    For the SMS thing, if I recall correctly I was about to / done implm some working code thanks to one of our prev talks, so I'll just digg my notes/code & update that as well as reflect the update on the github repo ( .. )
    Nevertheless, I'll digg what you suggest to see if some have tried some fancy chars in their SMS, or even MMS ? ( .. )

    ps: after opening 8 dvd drives, & collecting 3 stepper motor-driven mechanism, I may be able to hack myself those tiny 3 axis thingy ;P
    nb on the ps: it makes me wonder: would it be feasable to implement a Grbl in js ? ^^

    ps2: while not currently working on it ( I need more tiiiiime ... :/ .. ), I recently done some experiments with both NodeJS ( write a basic module, & learn how to write a C++ one ) & Electron ( github's NodeJS-based app framework ), and it was quite frustrating not being able to make that nodeJS module you wrote for Espruino working within Electron ( & looking online, it seems I'm not the only one experiencing this issue .. ): any lucky guess ?
    Also, on a near subject, I really have to digg how to 'mix' some aspects of Chrome Packaged Apps with Electron apps: being able to handle weblinks is a must, while having native-like top menus is really neat & 'feels' native ( contrary to the way ChPaApps & node-webkit worked .. ).I think it may be done in several ways, one of hich may be spawning a Chrome Packaged App that handles weblinks within the Electron app ( if we can't make the Electron app direcly recognize chrome weblinks, which could be understandable )

    ps3: I almost forgot ;)
    The other day, I was writing some silly script to deduce which combo of resistor values from a particular stack would fit the required value or be the closest to it.
    The simplest fcnality was easily done after some tinkering ( "get biggers first" ;p )
    Then, while this worked 'fine', sometimes, an alternative 'combo' allows ending up with less resistors ( for a remaining difference closests to 0, aka closer to the required value ).
    I consider the above achieved, and after a slight mod of my script it could do that as well ;)
    Now, when I'm back at it, I'd really love to be able to get the "best of both worlds" by deducing the 'best' combo in terms of "the less resistors used the better" in combining the above 'ways' of doing so ( ..).
    I wonder how complicated it can get or instead how silly it could be, but I didn't finish my logic on paper to be able to implm some test code ..
    .. be my guest ? ^^
    https://github.com/stephaneAG/circuits-c­alculator/blob/master/wip_ideas/resistor­sComboWIP.js#L355
    ( the NodeJS module is working fine, and before that I could even generat a poster-like of the resistors I own by hacking around chrome browser javascript console logs & imagemagik ;D )
    https://github.com/stephaneAG/circuits-c­alculator/blob/master/wip_ideas/Resistor­_nodeModule.js

    I'll be back with updates as christmas gifts ;P
    Keep up the good work +

  • would it be feasable to implement a Grbl in js ?

    I don't see why not... I guess it wouldn't be quite as good, but you could definitely get something. I did a GCode reader a while back for an Espruino-powered laser cutter and it'd be trivial to extend that for 3 dimensions.

    Afraid I just don't have time to look at the resistor calculator though :( Maybe someone else would take a look?

  • Hi there !

    I just took a "somewhat quick" look at what you've done so far using that plotter as laser cutter & the code beneath it ( loading from SD card is a neat feature ;p )!
    Nice work done on that !

    When you say "wouldn't be quite as good", do you implicitely suggest the many / skilled people behind the Grbl project ( & the many version updates ) or think hardware-side ( aka an Espruino implm of Grbl would be a little less fast / introduce unwanted delays ? )

    I guess for now, I'll complete my wip setup ( in the photo ) with an ATmega328 to replace the currently used Ar. UNO, but I'd find pretty neat to gave some Grbl Node module to control some Espruino Grl module .. ;P
    My current setup ;p

    On the "Resistor Calculator" side of things, don't you worry, I may get hints from friends of mine with a scientific background if not too busy themselves .. or I'll just do as usual .. digg deeper & hack a way* out ;P
    *understandable for my skillset ;)
    Also, I still have to add the 'SVG generating stuff' to the module's code (..)

    Last but not least, as I wrote this little tool to help fix the "over voltage" warning messages I was getting with my tests with the SIM800L, I'd better finish that SIM800L module first before thinking about "upgrading" the Resistor Calculator code ;p

    ps: I'm about to digg the Espruino graphic lib ;p

    Keep up the good work +

    On the picture:

    • 3 hacked steppers scavenged from DVD drives
    • 3 EasyDriver boards to drive them
    • 1 ATX PSU with PS-ON jump-wired to Gnd, providing +5V
    • 1 no-brand cheap 3d pen
    • DVD casing to make the structure
      To be done:
    • screw everything together
    • build "spindle direction & enable" logic on protoboard to allow forward/backward feed

    Nbs:

    • no laser by now, but I have some littl' drilling set & "shaft chuck collets" coming

    1 Attachment

    • IMG_9123.JPG
  • Wow, I'd love to see how the 3D printer goes!

    Well, Grbl has had a lot of work put into it, and a lot of debugging! The STM32 itself is much more capable than an Arduino, but because Espruino's JS execution speed isn't that fast, I think it could struggle doing some things unless you were willing to write some C code extensions.

    Having said all that, using DVD drive steppers you're not going to be going that quickly anyway, and you probably wouldn't notice much difference if you used Espruino :)

  • Hi there !

    [ I hope you won't see this message after I write it but instead keep on resting ;p ]

    A few [ very little ] updates on the project:

    • I bought myself a drill (!) for Xmas ^^ ( Ryobi rpd500-g ) + a stand, so now I'll be able to drill holes in stuff without borrowing someone's tools :D
    • As I'd need that later, I wrote down a little doc on the main dimensions of my version of the Hacked CNC ==> http://stephaneadamgarnier.com/HackedCNC­/HackedCNC_tefDoc.pdf
    • Then, as I couldn't do much on the hadware-side of things ( aka, I'm still waiting the standoffs & other stuff I need to have those axis correctly & properly positioned ), I had a littl' fun with the SVG I had from Illustrator ( & also learn a bunch of stuff on how Illustrator DOESN'T handle stuff as you'd expect when applying 3d effects ( I could do da whole writeup on this by now .. ) ) ..
      .. so I wrote a quick [ & very naïve ] CNC js obj & had it "pseudo-parse" pseudo-G-Code ;p
      ==> http://stephaneadamgarnier.com/HackedCNC­/wip2.mp4
      nb: It doesn't hang on the actual animation, juste when recording the screen at the same time with all the stuff I have open ( .. you'll even see some Chrome Packaged App crashing while screencasting ^^ .. ) ;p

    As you 'll see in the video, one of the nice thing is the ability to toggle between a 2d & a 3d representation while the SVG is being animated
    I plan to add the ability to rotate around the "global" Y axis ( not the SVG's Y axis ), but this 'd require a different handling of stuff in code ( aka having one SVG for each axis frame, and not only one holding everything as by now ), although I'm pretty sure it'd work "right out of the box" ( being only matter of mapping keyboard keys / mouse || touch D&D to update some CSS transform's rotateY() value ( .. ) )

    As soon as I receive the stuff needed [ & come back from the new year's stuff ;p ], I 'll update the project ( as usual ^^ )

    See ya +

  • Wow - neat idea developing the whole thing in the web browser!

    I'd love to see how this works - using an off the shelf 3D pen makes everything a lot easier!

  • Hi there :) !

    Since the new year has been busy, it's been a "long time no update" on this thread, yet I have some neat stuff to share as well as, as usual, some more questions that awaits answers ;)

    ps: I hope you did indeed have the well-deserved rest ;)

    So, onto the good stuff:

    • On the "hacked CNC project", I finally have some work done:
      -> after receiving a drill, a drill support, some drill heads, some M3 standoffs of different lengths & corresponding nuts ( still waiting to receive M2 & M2.5 stuff yet .. ), I was able to build the structure of the CNC as well as have 2 of the 3 axis mounted ( and a power source from a scavenged dvd reader that fits inside the bottom of the structure, with access to the button on the front side of the CNC ).

    -> while the 3d pen is hacked to provide the bare minimum in terms of fcnality ( in other words, "extrude" & "release", from the 2 push buttons already present on the pen ), I still have to investigate the pins on which I've soldered some headers ( ^^ ) as well as think about possible ways to modify stuff like feed rate, ..

    -> still on the 3d pen side of things, modifying G-Code files to handle preheat/|status & wiring some stuff to the pen indicator LEDs || having the color(s) detected seems like some ways to walk along for a better yet still easy use of such off the shelf device ( .. )

    -> on the more general hardware side of thing, I posted the complete schematic of the project at the following address:https://123d.circuits.io/circuits/152807­3-yahc-yet-another-hacked-cnc-based-on-a­tmega328-grbl

    -> I also had some thougths about the animated SVG: it could be quite nice to "simulate" the different layers of matter being added ( by splitting a drag&dropped 3d model into several SVGs, being animated in the way they're filled along with the movement of the different axis for ex ), as well as have the CNC SVG reflect the current position & status of the real one ( ex: to have a cam following the head is one [ nice ]thing, visualizing the movement & status at a glance in a cute* crude SVG is another .. )

    -> also, while I did follow the link you provided on your GCode reader, I didn't took the time yet to digg into your code & see how I could add another axis & stuff ( .. ) :)

    -> last but not least, I seriously plan to make the CNC wireless ( considering a WiFi serial bridge is easily done with our beloved ESP8266 ), but doing so I'd want to use this opportunity to add some simple yet useful features to the device:

    • being able to either be driven using USB or WiFi ( probably an electron app / chrome app)
    • control it & update the animated SVG in regards ( using websockets on the Espruino ? )
    • updates the files on an attached SD card / list them ( for download or printing ) in the UI
    • provide terminal-like interface to execute commands over serial / WiFi
      => the Espruino 'd "replace" the laptop ( streaming Grbl code to the ATmega328 ) as well as provide some control over Grbl remotely ( thx to Esp8266 ) & provide "SD file server" to list files, init prints, .. and a UI with said fcnality ;D

    -> few pics of the current state of the CNC build & the 3d pen attached ;p

    • On the "Resistor" project ( NodeJS module ), I plan to try applying what I could read on genetic algorithms ( the guy writing the tut used it to deduce the most compact ways to pack different shapes, or even where could fit the largest possible circle among other circles & how big 'd it be ) to find the possible solutions that'd most suit the needs ( be the closest possible value while keeping item count the lowest ) --> more on this soon ;p



    *- Talking about cute, I have yet another project for which I have few questions, mainly focusing on power handling & battery charging ( I don't wanna mess with those .. ;p ):
    You'll see in the attached pics a teddy bear I'm sewing ( name's Me4e ;p ), and that 'll be stuffed with a pico as well as a pienoze||speaker & a battery, as well as the sensors that are already built for the body & arms, the goal being to enter a pattern of squeezes on the arms & body which 'd trigger a sound playing ( & pausing the sensors while playing to resume them afterward ).

    The schematic is already done for the most part, but I'm not entirely sure of the best way to power the Pico as well as recharge the battery safely without software to do so ( handled on the hardware side by an Adafruit LiPo backpack ): in other words, I don't know whether to build the powering part of the circuit as the version hosted on the 123d circuit link below:
    https://123d.circuits.io/circuits/154523­0-i-me4e

    or as: ( "LiPo" is the Adafruit LiPo backpack circuit ), without shorting the FET/B0 jumper
    Pico 5V <---> LiPo 5V ( charge )
    Pico Bat <---> LiPo Bat

    From what I currently understand, it would be simpler than in the circuit hosted, which relies on a USB port line ( -> btw: relation to B0 ? )

    Anyway, I need to provide a female USB port to the device, so the Pico 'll have its USB port plugged as well ( the USB part of the circuit let untouched, except for the part that checks if we have a voltage on the USB line), so it's more a question of knowing what to do than of trying not to touch the USB line(s) ;p
    ( although, the most simple/tiniest circuit are always welcome as usual ;p )

    Lastly, I was wondering how to keep a uC powered up after some switching off had occured ( ex: to play a goodby sound & do some cleanup/halting routines before actually powering it off ). You'll see a quickie of the idea in the bottom-right corner of Me4e's schematic, from which I'm sure you'll think of a [ wayyy ? ] simpler version considering the Pico as the only hardware on which this 'd be tested ( by now, yet these sort of stuff could be indeed useful on the RPi & others as well, where I'mm pretty sure they're already been implemented .. anyway ;) )

    And, "what needed to be done" [ and what 'll have some rework ]: as I couldn't import the Eagle files of the Pico on 123dCircuits ( need the .sch file it seems -->https://123d.circuits.io/eagle/import ) , I added it* ( https://123d.circuits.io/components/1544­978-espruino-pico ) to have clearer schematics ;P

    • the PCB view pinouts are WRONG ( MY fault --> I didn't take the time to get the correct alignments, I just wanted the schematic view for now ;p )

    5 Attachments

    • Me4e_StephaneAG.JPG
    • IMG_9052.JPG
    • IMG_9064.JPG
    • IMG_9066.JPG
    • IMG_9345.JPG
  • Oh,and by the way ( while I'm at soldering the stuffing of Me4e ;p ): do you have any hints on interfacing the following electret mike breakout ?
    http://makersify.com/products/adafruit-e­lectret-microphone-amplifier-max4466-wit­h-adjustable-gain
    -> if so, I mmay as well give ears to the littl' guy ;D

    The following link is the only thing I could find on using the Espruino for audio input stuff
    http://forum.espruino.com/conversations/­271687/

    Thanks ;)


  • Looking good! Huge post though!

    As a starter, actually having a WiFi print system would be quite cool (that just took an uploaded file and sent it over serial to another 3D printer). There have been some issues reported with the ESP8266 though, as there's no flow control - so you'd need to set the baud rate quite low so you have time to write everything to the SD card.

    For the power supply/charger, as you're connecting to the Pico's USB - use the Pico USB power for the charger, and then connect the battery itself to 'Bat' - everything should work great.

    I'd consider just always keeping the Pico powered, and when its done its stuff, just turn Deep Sleep on. That should bring power consumption down to ~0.02mA (realistically everything else connected to it will draw more power than that). Otherwise, power everything using a PFET, and connect it via an on/off button to ground. When you press it, it'll power the Pico up and the Pico can hold the PFET low, keeping power on. When it's done the Pico just turns that IO pin into an input, and the PFET turns all power to the system off.

    For the Mic, as it's got an amplifier in there, it should just connect up? Just follow any instructions for 3.3v Arduinos, as it'll be identical.

    Seriously though, you should try and do some smaller posts - it takes a while to read through and I probably miss something :)

  • Hi there !
    Haha, sorry for that, I'll do my best to avoid that, starting now ;)

    I have few points that can be explained "briefly" ( :p ):

    -for the CNC & WiFi printing stuff, I have some stuff to digg, some note written down, ' just need some time mixing that up & taking hardware limitations in huge consideation ;)

    • for the power supply/charger, it indeed sems to work great ( it did during my tests on directly connecting to USB / charge battery, & use battery ), and is quite simpler that other alternatives ( thanks to using the USB pins as well as an external uC handling battery stuff properly ).
      Side note on this, the chip used on the Adafruit shield I'm using is a MCP73831, & requires a bare minimum of 2 caps & 2 resistors to work ok ( from what I could see studying the Adafruit datasheet )

    • for the "keeping it powered & when done ..", I'll have to digg the Pico's "Deep Sleep" ( & how to catch some pins activity while it's waking up, be them tied to btns or mikes .. )
      => the FET solution seems like a nice alternative / pretty close to what I had in mind ( & better, since we have a FET onboard already ^^ ), though I don't know enough yet on FET to my taste .. ( nor do I on NPNs & PNPs, but I feel more familiar to them :) )

    • for the mikes, connecting was easy enough ( hum, 3 wires, one Gnd, one +V, where could we possibly use the third ? .. /!\ a tiny-tiny Pico ADC pin ^^ ), but I was talking about some existing lib ( that may use Waveform internally, for ex ) that 'd be pretty close to the Arduino's "µSpeech" lib ( I guess I'll just have port it / write a little one if not ( .. still gotta finish that SIM800L stuff :/ .. ) )

    • on Me4e ( the cute pluche :D ), I'm gonna have to write the following:

    • simple GUI on desktop [/tablets/phones] to flash the "brains" of it ( Pico ) via USB ( desktop ) & audio ( tablets / phones )

    • way to flash it as well using a file stored on the SD card ( ' already got some tests code on that ( .. ) )

    • "companion app" ( if I can't / need more that the above µSpeech stuff )

    My question(s) is on the said "companion app": I plan 2 scenarii of using it in tandem with the pluche:
    -A: talk to Me4e -> it streams audio to phone -> the app converts to txt, parses it, & send back some commands/data to Me4e -> Me4e then does/says stuff
    -B: talk to phone app directly -------------->

    Now, as you guessed already, I'm wondering if the ESP8266 can be used in such manner ( seeing stuff like http://hackaday.com/2015/06/06/esp8266-a­s-a-networked-mp3-decoder/) is interesting .. ), and whether or not it requires additional flash AND hardware fixes for flow control or other finicky stuff ( .. )

    • lastly ( and I really hope I achieved a tinier post than the prev one ): I added some quick POC code to the SingleButtonMulticodesCombinationLock ( ^^! ) to handle patterns from different pins ( .. )

    This being said, here's a few pics on the Me4e project, and while the schematic & pluche is done, I still have to write that brain of his ;p
    I guess 'll be posting a detailled explanation of the project on HaD.io ( .. )

    Looking forward to reading from you soon, thanks for the quick support when I needed it ( thanks to that I did indeed make it in time for Valentine's day ;) )

    Cheers, & keep up the good work :D

    ps: also, ' got 2 more Pico's coming, some Z-tape, and I really wanna try a circuit made of conductive ink laid down using the hacked CNC ;P
    ps2: remember me to hang myself when I only have lead free solder left ..

    ++


    4 Attachments

    • IMG_9580.JPG
    • IMG_9578.JPG
    • IMG_9574.JPG
    • IMG_9573.JPG
  • You can still buy leaded solder - order it from china, they'll ship it to you.

    Also, consider using hot glue to keep those wires from flexingright where they meet the board. That is a very common failure point, especially sincepeople tend to squeeze plushies.

  • Me4e looks really fun! As @DrAzzy says, hot glue could provide some much-needed support!

    The Pico has 128kB of flash memory available - I wonder if you could get some speech into that, rather than having to wire up an SD card?

    uSpeech looks amazing - seems like it uses some really hacky ways to detect what you're saying, but if it works... :) With some careful re-writing you might be able to use E.sum/etc to quickly scan over the data - as normal JS would end up being a bit slow.

  • Hi there !

    +DrAzzy
    -> sure , I did actually bought some on ebay ( of different diameter, also ;p ), but it never happened to me before to have only this type & not being able to make a correct & quick solder between multiple elements ( joining stuff to already soldered stuff has never been such a pain ! :/ ), plus I had to be done before late evening to make it for Valentine's day .. -> :|
    -> on the hot glue stuff, I totally agree, I should have put some on all the pins to make it more bulletproof, but here I guess I had the chance to stuff enough cotton to keep stuff in place, plus the head doesn't contain any squeezable stuff [ on this version ? ;p ], so it shouldn't experience as much stress as the other parts.
    -> still on the hot glue topic, I ended up sewing a little pouch for the battery to keep it in place internally ( I have sort of sections of cotton & sewed the parts that shouldn't move, like body sensor ), as I wasn't confident in hotglue-ing it to anything ( in my mind, hot glue + battery = incoming troubles ? )

    +Gordon
    -> thanks, I must say I had quite a fun time ( aside from the strees in the planned delivery time ) ;)
    -> I'll have to digg how many flash is used by the Arduino implm of µSpeech ( as an average example ), yet using the Pico's flash is a indeed very neat idea ( gotta study that ;) )
    -> yeah, µSpeech seems pretty neat considering its lightweight ( although I didn't tests it personaly yet ).I digged a little bit the online docs ( where there's a section on porting it ), & very quickly through the actual code: it seems quite simple when its author explains it, and quite remarkable in the usage => I gotta test that :P
    -> thanks for the hint on E.sum, I'l hope it'll pop in my mind when needed ;p

    => now gotta try a quick implm of a audio 2/3 tracks webapp* for a friend of mine, I'll post updates when I have time to achive them :)

    => I'll also post the wip of Me4e on HaD.io at the following URL ( still gotta upload the pics & label the steps with few (yes, few ;p ) useful comments ): https://hackaday.io/project/9726-ime4e

    • if anyone has a working & nice way to save audio files out of the Web Audio API ( also working on iOS/android)**, let me know :D
      ** ' already got some S.O. tabs open & gotta take some notes outta them in the meantime ;p

    This being said, gotta make that bear dance .. ;p

    +

  • hello

    a quick update:

    1: Me4e now has a repo & a gh-page website, with useful links:
    http://stephaneag.github.io/I-Me4e/#v01a­

    2: as it seems I can't have electron apps running on my old 10.6.8 OS X install ( not supported by Electron as far as I can read in the different versions of the docs ), I guess I'll have to try mixing them with node-serial [ & fixing stuff if needed ] later & on linux ..
    .. hence I did a quick Chrome Packaged App to handle updating the code on the Espruino ( using serial ), updating some settings ( stored on the SD card, through espruino's serial conn. ), getting latest stuff ( "firmware(s)" & settings config(s) ) from github, ..

    It's available at: https://raw.githubusercontent.com/stepha­neAG/I-Me4e/master/app/Me4e.crx
    ( code 'll be on github soon )

    3: still on Mac OS X 10.6.8, I have a weird error in the Espruino Web IDE & neither can I update nor communicate with connected & recognized boards.
    During my tests, I can use 'screen' to connect to it & do stuff ( without prefixing it with 'sudo' ), but using the IDe throws the message picture in the joined file & doesn't allow to either type in the left-hand side or upload code written on the right-hand side :/
    "ERROR: Already sending data - calling callback immediately!"

    Qu is: may it come from a "non properly closed" previous seiral conn. or do I have to use some "sudo usermod -aG " ?
    ( I noticed a difference while issuing a 'ls -l', I got .. " tty .." for most stuff in /dev/* but ".. root wheel .." for the tty associated with the connected Espruino ).

    I noticed the espruino.rules file ( https://github.com/espruino/Espruino/blo­b/master/misc/45-espruino.rules ) to prevent it from appearing as "STM32 Virtual ComPort", but I wonder if it 'd work, with changed to reflect the productId & vendorId I have using the chrome serial API.

    I really hope this only happens to "old" versions of OS X or to find some simple solution to this, to simply the end user usage ;)

    4: on the repap-side of things, I stumbled upon the following link, which may interest some of us ;)https://github.com/lhartmann/esp8266_rep­rap

    this being said, gottta start uploading the pics for the step by step instructions .. ;D

    looking forward to reading your inputs ;)


    2 Attachments

    • me4e_espruino_debugKit.JPG
    • me4e_espruino_pbSerialMac.JPG
  • Hi again

    I tried my best but something's just not right with Chrome Packaged Apps & serial on the OS X install I have: I can access an Arduino or an Espruino using screen, but can't neither receive or send to/from them in any Chrome Packaged App

    I noticed it may come from the rights given to the /dev/tty.usbmodem131 ( Arduino ) or /dev/tty.usbmodem1431 ( Pico ), but it seems I just can't get them right ( although I did see a blink when connecting to an Arduino using Chrome Serial API & issuing a chmod 777 on the Arduino port beforehand .. :/ )

    Too bad, since aside from this, the "big part" was checking how to push code to a connected pico & call js on it from the Me4e chrome app :|
    -> on this, if I'm correct, I just have to include the espruino tools js file in my app & call 'CodeWriter.writeToEspruino()' when needed, right ?

    I'll try to fix the above stuff as soon as I get some deserved rest ;p

    Any help very welcome :D

  • Latest versions of MacOS don't seem to work well with serial devices. People over on Arduino forums often have problems with that.

  • Hmm, not sure what to suggest. You mentioned that Electron works ok? I tweaked the Web IDE to work with nw.js, and you could probably try that (or could presumably port it over to Electron pretty easily?).

    Another option is to use a USB-TTL adaptor and program Espruino that way? Hopefully the drivers for those are better on Mac OS than the usbmodem ones?

  • all right .. just got my post erased by some CSRF verification that failed .. :/

    thanks for the quick answer :)

    +DrAzzy
    it mays comes from ~4 vectors:
    -mac app store install / update => possible kext bogus ?

    • chrome version no longer supported => so can't comm over serial ?
      -electron install => did it mess with stg ?
    • me trying to fix stuff but diggin my grave ..
      I'm still digging & trying, and 'll post a/the fix as soon as I get it/one ;)

    +Gordon
    currently trying to figure out the fcn call invoked by a click on the 'icon deploy' in the Web IDE, I'm trying to get EspruinoTool working with the minimum possible overhead to mix it easily with my chrome app ( it seems I have huge trouble in doing so, since stuff loads correctly only if I use the Web IDE src entirely :/ )
    What I actually need is just the sendFile / expr / flash abilities ( and the libs used by those )

    I'll post the src of the app & a screenshot/gif of it on the dedicate repo after a quick rest, and I'd be glad to find some useful hint lying here for me to catch ;D

    If I recall correctly, porting from nw.js to electron 'd be a matter of using "nodeglyph stuff" ( no sure on this ), but I'm not confident enough in doing so ( I was trying to use Electron + serial before writing a chrome app, but Electron is not supported on Mac Os X 10.6.8 and I didn't have the time yet to try on Ubuntu )

    As I think I'm nearly finished with the brains of Me4e, if I could have it's desktop app working at least on Ubuntu by the end of the week end it'd be great ;)
    -> I really want the "upload animation" to actually do stg in the app ;p ( see gif on the repo ;p )

    +

  • What are you actually trying to do? If you just want to send characters over serial you can just use this: https://github.com/espruino/EspruinoTool­s/blob/gh-pages/core/serial_chrome.js

    Although it might be easier to use Chrome's serial API directly.

    You don't actually want to include all the dynamic module loading and stuff into your me4e thing do you? If it's just a matter of sending commands, I'd just send them over directly.

  • a little update:

    I can now send stuff to Espruino from Ubuntu using:

     chrome.serial.write(str2ab("<some expression>;\r"), callback)
    

    and with a simple listener, I also get the callbacks ;D
    ( I'll try few stuff to have dynamic listeners to check for specific callbacks later ( .. ) )

    I currently use Gordon's implm of str2ab ( found in the 'serial_chrome.js' ) as it handle some chars stuff that the chrome examples implms doesn't, but gotta try the other just to know if it'd work ^^

    The issue is still not solved on os x 10.6.8 & I filed some stuff hoping to get a feedback ( among other forums, the issue may be close to this one: https://bugs.chromium.org/p/chromium/iss­ues/detail?id=448698 )

    +Gordon Nope, you're right: I want the minimum overhead possible, so just the bare minimum to send commands & send a file, and maybe later flash the board ( like in the Web IDE ).
    On this subject, am I the only one interested in getting the minimized code sent from the IDE to Espruino saved to an external file ? this 'd ease sending minimized/optimized files afterward without the need for the complete IDE to be installed/run

    As sending commands is almost done now, so I'm starting to digg how to replicate 'sendFile()' & 'flash()'
    My two contexts are the D&D of a file on the chrome app:

    var dnd = new DnDFileController('body', function(data) {
      var fileEntry = data.items[0].webkitGetAsEntry();
      displayPath(fileEntry); // display the fullpath to the entry
      // display the contents of the file
      fileEntry.file(function(file) {
        var reader = new FileReader();
        reader.onerror = errorHandler;
        reader.onloadend = function(e) {
          console.log(e.target.result);
          var theCode = "reset();\n" + "echo(0);\n" + e.target.result.replace(/\n/g, "\x1B\x0A") + "echo(1);\n" + "save();\r"; // code ready to be uploaded to the Espruino (nb: doesn't save any previous config nor update settings except those present in the file )
        };
    
        reader.readAsText(file);
      });
    });
    

    and getting one from the sandboxed fs:

    theFs.root.getFile('/Firmwares/fakeFirmw­are.js', {}, function(fileEntry) {
      fileEntry.file(function(file) {
        var reader = new FileReader();
        reader.onloadend = function(e) {
          console.log(this.result);
          var toUpload = "reset();\n" + "echo(0);\n" + this.result.replace(/\n/g, "\x1B\x0A") + "echo(1);\n" + "save();\r"; // code ready to be uploaded to the Espruino (nb: doesn't save any previous config nor update settings except those present in the file )
        };
        reader.readAsText(file);     
      }, errorHandler);
    }, errorHandler);
    

    For 'sendFile()', can I send everything at once using the above concatenated stuff or do I have to do it line by line / by chunks ( or "throttled" serial write ) ?
    ( for 'flash()', I guess I'll see later, but I feel it'd be a little more complex .. :p )
    Also, I based the above stuff from codeWriter.js

    // ..to tell Espruino it's a new line but not to execute ( as Alt+Enter or Ctrl+LF ): stuff.replace(/\n/g, "\x1B\x0A");
    

    Lastly, and this is the end of this post to keep it short, I noticed that the message I had in the Web IDE running on os x 10.6.8 comes from a call that resides in the serial.js file at line 147 ( https://github.com/espruino/EspruinoTool­s/blob/gh-pages/core/serial.js )

    console.error("Already sending data - calling callback immediately!");
    

    I was wondering why this fcn 'd be called in the context of the Espruino web IDE in its Chrome packaged app version, since calls should normally invoke functions declared in serial_chrome.js to use the chrome serial api ( as both are loaded in main.html, and as I didn't stumble upon the code that'd choose one or the other depending on some criterias ( line 66 of serial.js ? ) ).
    This may be totally normal, but I never saw this in the console of the IDE while on Ubuntu, so if this could lead to solving some issues, I can't afford not to ask :)

    looking forward to solving those & reading for yall ;p

  • Why do you do e.target.result.replace(/\n/g, "\x1B\x0A")? I think this is changing newline to alt-enter? In the IDE it's a hack to get around people who write code with the opening brackets for functions on a different line.

    By sending alt-enter for everything you cause the entire file to be stored in the input buffer before being executed, rather than executed one function at a time - it'll mean you can't upload anywhere near as much code before running out of memory.

    flash

    This'll be pretty difficult to pull out. Do you seriously need that? Can't you just connect with the Web IDE when you (rarely) need to update the firmware?

    console.error("Already sending data - calling callback immediately!");

    Yeah, this is because I changed the serial code recently and put it in for debug. It's actually not a big problem.

    The issue is that with the 'throttled send', the buffer gets added to a send queue but the callback gets called immediately. It should really be a warning, and infact serial.js should really handle it and should be able to call the callbacks in turn - but i'm lazy

  • Hello

    I wasn't sure about .replace(/\n/g, "\x1B\x0A"): I just saw it was used in the code of the IDE when sending & was wondering what it exactly aimed for -> now I know, and that's not what I wanna do :)
    Now that I do know, I won't, and 'll just forward the file's content to the Espruino "as is" :D

    For the flash part ,I bet it'd be harder to implm, and I actually don't need that ( but I'll dig the code anyway, hoping to get a glimpse of what's happening ^^ )

    For the Already sending data - calling callback immediately!"that I got on os x in the console logs while I can't write to / receive from it ( yet able to connect to it ), now I know it's not related ( I thought it may be somehow (..) ).

    For the "throttled send queue", understood :)
    I did "deferred calls" based on time, not buffer fillness, a while ago, so I get the point, although I'll have to see how I handled the callback there (..)

    On the Mac os x 10.6.8 troubles, I made some tiny progresses:

    • I wrote a reminder on how to allow/debug serial ports access: https://github.com/stephaneAG/Arduino
    • I tried modding the USBFTDI .kext to add a definition for the Pico, but it seems the .kext is unloaded as soon as it's loaded ( ?! )
    • I tried using the Espruino IDE's console to talk to a connected Espruino: it worked flawlessly !

    So, my last guess is it comes from Chrome / some of its dependencies ( else I wouldn't be able to talk to the device using "native" apps that rely on the OS's implm ):

    I'll try reinstalling it & see if the troubles goes away

    Lastly, I'm currently adding the step-by-step instruction on how to build Me4e, and thanks to you I'll be posting the sources of the desktop app soon :)

    Keep up the good work ++

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

yet-another-intercom-hack

Posted by Avatar for stephaneAG @stephaneAG

Actions