How can the puck connect to the internet?

Posted on
  • Hi,
    I'm thinking of buying a puck.js and I read on the kickstarter page that it can connect to the internet.
    How so? Does it connect to the internet via bluetooth?
    kinda like this:

    PUCK --bluetooth--> COMPUTER --wifi--> INTERNET
    PUCK <--bluetooth-- COMPUTER <--wifi-- INTERNET

    is this correct?

    Thanks!

  • Computer or smartphone ;-)

  • Yes, realistically you need some kind of bridge. There's some software that can run on a Raspberry Pi that can act as a proxy - there's a little bit of info here: http://www.espruino.com/Puck.js+HTTP+Pro­xy

    However, you can also connect an ESP8266 WiFi module or a GSM/LTE module directly to Puck.js and it can access the internet that way, using all the usual Espruino http & socket APIs.

  • @Gordon Is there a tutorial for "directly connecting" a ESP8266 to the Puck? I'm not sure how this would be done. Thanks!

  • It appears I'm having an issue with the pin not reading properly. Even if I connect directly to power or ground, it reads random values constantly through analogRead or digitalRead. Seems I can't get a solid connection.

  • Are you sure you've got the correct pin connected? Maybe you could give me a bit more information about the code you're using and where you connected. Also remember that you always also need to have ground connected as well.

    For ESP8266, it's basically what is here: http://www.espruino.com/ESP8266

    • Make sure your firmware is up to date
    • Get an ESP8266 with its own power source (the CR2032 in the Puck won't cut it)
    • Ensure it's wired up with BOOT/CH_PD as shown in the link above to make sure it boots up in wifi mode
    • Connect ground -> ground
    • ESP8266 TX -> D29 (Puck.js RX)
    • ESP8266 RX -> D28 (Puck.js TX)

    And then this should do it for you:

    Serial1.setup(115200, { rx: D29, tx : D28 });
    var wifi = require("ESP8266WiFi_0v25").connect(Seri­al2, function(err) {
      if (err) throw err;
      console.log("Connecting to WiFi");
      wifi.connect("WiFi_Name","WPA2_Key", function(err) {
        if (err) throw err;
        console.log("Connected");
        // Now you can do something, like an HTTP request
        require("http").get("http://www.pur3.co.­uk/hello.txt", function(res) {
          console.log("Response: ",res);
          res.on('data', function(d) {
            console.log("--->"+d);
          });
        });
      });
    });
    

    Personally I'd also ditch the Puck's 3v battery and connect the 3.3v from the ESP8266's power supply to the Puck instead.

  • Didn't you update to use hardware flow control on the espruinoWifi? Doesn't that mean there would need to have the rts and cts pins wired too?

  • Doesn't that mean there would need to have the rts and cts pins wired too?

    It only uses CTS, but that only applies to the Espruino WiFi board - the original ESP8266WiFi_0v25 module should be fine as-is.

  • Can we use Ruuvitag with esp8266 to achive the same ?

  • Yes, you should be able to - as long as you use two pins that aren't connected to anything else, just connect RX, TX and GND - and then power the ESP8266 from a higher power 3.3v power source and you'll be fine.

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

How can the puck connect to the internet?

Posted by Avatar for BootySnorkeler @BootySnorkeler

Actions