Home Page Forums Tinylab Share your TinyLab projects

This topic contains 7 replies, has 1 voice, and was last updated by  gtinylab 1 year ago.

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #199

    AndreN
    Member

    Just creating a place for people to share any cool projects they create with TinyLab.

    To start, you can find some projects I created on my GitHub: https://github.com/AndreNeedham/TinyLab

    Projects on my GitHub:

    Simon – Like the Milton-Bradley “Simon” sequence repeating game. An LED flashes. After that, press the button under that LED. Now two LEDs flash in sequence. Press the buttons in sequence order. Keep going until you miss one.

    Breakout – Like the arcade game “Breakout”. Potentiometer controls paddle. Press S1 button to launch ball.

    TicTacToe – A standard game of TicTacToe. Use the S1 and S2 buttons to move the cursor (dot) to the square you want to play in, then press S3. Then the computer moves.

    StockTicker – Uses the ESP8266 WiFi board to request a US stock quote and displays the stock’s price and day’s change. You’ll need to edit the code to add your WiFi ssid and password.

    Note: for Simon and Breakout, hook a small speaker (8 ohm, less than 0.5watt) between pin 5 and ground. Otherwise, change the SPKR_PIN in the code to A1 to use the TinyLab’s built-in buzzer. But it won’t sound as good.

     

    #201

    gernot.abel
    Member

    Nice!

    #208

    gernot.abel
    Member

    Thanks so much @andren – your stock ticker is working out of the box and gives me some ideas how to work with ESP8266

    Do you have any ideas why the example code for mqtt by @Tinlylab https://github.com/sixfab/tinylab/blob/master/example_codes/3_ADVANCED/sensor_node/mqtt_esp/mqtt_esp.ino

    fails when compiling ?

    #209

    AndreN
    Member

    I haven’t tried the mqtt project since I’d have to reflash the ESP8266 and lose the AT firmware (I assume). I was concerned I would have trouble getting the AT firmware back on later. I really should buy a second ESP8266 so I could have one with AT and one I could flash with whatever.

    In any case, did you see and follow the instructions inside the code for building the project?

    ” To install the ESP8266 board, (using Arduino 1.6.4+):
    – Add the following 3rd party board manager under “File -> Preferences -> Additional Boards Manager URLs”:
    http://arduino.esp8266.com/stable/package_esp8266com_index.json
    – Open the “Tools -> Board -> Board Manager” and click install for the ESP8266″
    – Select your ESP8266 in “Tools -> Board”

    After that, I tried to compile and discovered I needed the following library:

    https://github.com/knolleary/pubsubclient

     

    After that, I ran into compile errors due to “setup_wifi” and “callback” not being forward-declared. Not sure why the sample code author didn’t run into that. To fix that, I added the following to mqtt_esp.ino before the setup() function:

    void setup_wifi();
    void callback(char* topic, byte* payload, unsigned int length);

     

    With those declarations, I was able to compile the project.

    #210

    gernot.abel
    Member

    yes – after I added your code

    void setup_wifi();
    void callback(char* topic, byte* payload, unsigned int length);

    it does compile.

    But you are right regarding to keep the existing firmware – need to order one

    #237

    gtinylab
    Participant

    My projects are available at https://github.com/GrahamCobb/TinyLab.

    They are not particularly useful or interesting and are just posted in case anyone finds any of the code or ideas useful.

    At the moment there is just one: a clock application to allow me to learn more about using the Arduino environment and various components of the TinyLab — it uses the RTC, LCD, 7-segment display and the ESP8266.

    #256

    gernot.abel
    Member

    @andren it seems like the StockTicker works as long as i keep requesting; as soon as I hold abreak for some minutes and try to request a new stock there will be no reponse. The menu still works fine!

    It might be that the network throws the Tinylab due to inactivity. Any recommendation how to verify?

    I thought to close the wifi connection after each request and reestablish with every request; but thats probably not straight fwd?

    Cheers, Gernot

    #257

    AndreN
    Member

    I probably need to do something with connection keep-alive. The other choice is to do AT+CIPCLOSE, then redo the AT+CIPSTART that was near the end of setup().

    #261

    gernot.abel
    Member

    where would you place the AT+CIPCLOSE ? at the end before return response; ?

    and call the // Open TCP connection to the host:
    sendData(“AT+CIPSTART=\”TCP\”,\”” + host + “\”,” + httpPort + “\r\n”, 15000, DEBUG); at inside the loop?

    #262

    AndreN
    Member

    Yes, for CIPCLOSE, put this code in function getStockQuote() right before the line “return outputString;”

    sendData(“AT+CIPCLOSE\r\n”, 2000, DEBUG); // Close server connection

     

    and take these two lines of CIPSTART code out of setup() and move them to the start of getStockQuote(), before the “// Construct our HTTP call” line:

    // Open TCP connection to the host:
    sendData(“AT+CIPSTART=\”TCP\”,\”” + host + “\”,” + httpPort + “\r\n”, 15000, DEBUG);

     

    I tested this out and it worked for me. I could make multiple stock queries successfully. I’ll update my GitHub with these changes.

    #267

    gernot.abel
    Member

    Merci – will test it tomorrow

    #268

    gernot.abel
    Member

    Super ! – works like a charm at work !

    now I just need to find out how to get data to thingsspeak

    cheers

    #269

    gtinylab
    Participant

    I have added another project at https://github.com/GrahamCobb/TinyLab.

    HumaxPower is a project to turn on my Humax PVR under command from another system. When it receives the command (a web access to http://<arduino-IP>/poweron?humax=<humax-IP>) it transmits the Humax remote control POWER button infrared code. I plan to use this so that my Humax backups always work (even when it is turned off).

    At the moment this is being prototyped on my TinyLab. But I hope to eventually move it to running directly on a standalone ESP8266-based board.

    #277

    gtinylab
    Participant

    My first project to move from prototyping on Tinylab to a real deployment! The HumaxPower project is now running on a Sparkfun ESP8266 Thing.

    The ESP8266 Thing seems to be a great board for small projects which need WiFi. This particular project can be mains powered, so I haven’t had to try out the deep-sleep feature yet!

    The Tinylab has been great to learn, experiment, develop and test the project. Of course, some work was required to move to the deployment on the ESP8266 Thing:

    • The 3.3V and low current supplied from the GPIO pins meant that I might have needed a transistor to drive the IR LED but, fortunately, in this application I can place the LED very close to the receiver so it is working just with a resistor.
    • The ESP8266 seems to have more program space so the WiFi library is more complex, including a simple web server. I decided to take advantage of that so I had to rewrite my web handling code.
Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.