arduino framework

Again., The ESP8266 Is a great product.. It adds internet connectivity to a quite fast processor and with the newer boards like the ESP 12. We also have plenty of memory and pins available. And with the Arduino IDE, we have a well known programming, environment and lots of libraries.. But what is lacking for a true internet of things platform? We need a software framework with the following characteristics: Simple connections to Web services. Iot devices have to be connected to the world, Simple interface to smartphone. Iot devices have to be simple and often without keyboard or display.. This is why they have to be able to get the information for Wi, Fi credentials and other parameters directly from the smartphone.. They need a sleep mode to extend battery life.. We all know that ESP8266 need lots of Energy and cannot work long time with batteries.. New software has to be loaded remotely over the air.. If such devices are deployed, they physically cannot be reached anymore because they are built in or have no programming connectors.. Future users would never want to deal with FTDI or other programming devices.. I start now the building of such a software platform and will show you my progress Today. I start with the first point And I hope I will be able to reach the last point in the next weeks To prove the concept I decided to build a device which connects to an official web service in Switzerland, which announced is all departures of public transportation.

. It then compares the actual time with the departure time and acoustically warns the traveler if the vehicle arrives.. This is very useful because it works completely automatic and also takes into account the time the traveler needs to walk or run to the next station., And it takes also into account if the vehicle is delayed. If the web service provides real time information.. Of course, you could get this information using an app on your smartphone, But this is very inconvenient because it needs many steps till you get the result and you have to repeat it several times to get the newest information.. My device will stand in our kitchen and will be started if I decide to take the next bus. To build the device. I started with understanding web services. in contrary to Normal HTML pages. Web services provide information in machine, readable form.. Popular formats used by these services are XML and JSON. With IOT devices we have to preserve memory space.. This is why I prefer JSON over XML interfaces.. Therefore, in this video I will concentrate on this technology. JSON or Javascript Object. Notation is an open standard format that uses human readable text to transmit data objects in a standardized format. JSON messages are provided by so called RESTful Services which communicate over HTTP and use verbs. Like get post put, delete, etc. Because my IOT device only wants to read information, we will concentrate on the GET work. As a first step.

We have to find the web service, which provides us with the needed information.. This is typically done by a Google search or by going to the site, httpswww.programmableweb.com Let’s assume you found an API which delivers the information you need., Then it is good to read its description to understand the syntax of the call and If you know the syntax, the Best next step is to try it out manually.. To do this, I installed an app from the Google Chrome web store.. You find the link below in the comments. The syntax of the Swiss Transportation. Api is on this slide.. It consists of three parts, an address. The two cities where the journey starts and ends and optional a statement to restrict the number of fields which are returned from the web service.. This part is very important because it reduces the effort to find the right information on our small IOT device. Let’s test. This service., As already said, I need the GET message.. I write the call in the respective line and hit send.. I get now three parts of information.. First, I get a status message and second, I get the header information.. The third part is the information. I am interested in.. It displays the next departure from Basel to Zurich.. This message has only 67 bytes.. If I switch to raw, I see the string which I have to decode later in my program on my ESP8266., But let’s play a little with the api.

. If I remove the optional field restriction, the message is much bigger., It has now 1764 bytes and it would be nearly impossible to handle it on a small IOT device.. Here we learn an important lesson., Keep the big work in the internet and not on your small device. The return message is exactly, as you see it, here. The first line will be the date line and the last line will be the connections line.. Our program just has to check if the status of the message is okay., It is status 200 and then read through all lines to find the sub string quotdeparturequot.. The numbers of desire are then in a constant distance from this keyword. Hours minutes and seconds of the next departure. Let’s. Now look into the code.. We have to read and decode the response.. Bigger computers usually read the whole message in one block and decode or parse. It afterwards. For small devices we read line after line and search for the keyword quotdeparturequot here passed to the subroutine as the variable lookupString.. If we found it in a particular line, we extract the three variables hours minutes and seconds using string arithmetic.. At the end, we can return the next departure time to the calling code, But how is the request message? Looking It consists of three lines.. The first is similar to the one we used in the manual scenario, but without the host name.. The second line adds the host information and the third instructs the server.

If we want to keep the connection alive or close it after the request., The respective program code is straightforward., Do not forget the carriage return and line feed characters.. Here I want to call your attention to a particularity of the ESP8266.. The WiFi traffic is handled in parallel to your normal program execution, and you do not feel it because the ESP firmware handles it without intervention by stealing some time of your program.. If you do loops, this stealing can be prohibited and the ESP crashes.. If this happens, you have to enhance waiting loops with a short delay., Never wait in a while 1 1 loop.. The ESP will crash immediately and produce a dump.. Only if you enhance your loop with a small delay1, your ESP will run without any problems.. In this video we were able to discover a web service providing a RESTful API. Check it out, manually. Program, a call from the ESP8266. and decode the JSON formatted messages.. Now we are ready to move on with our IOT framework. In the next video. I will show you how to connect your ESP to your smartphone or PC to enter the needed credentials for the Wi Fi Network and other data.. Here you see the current status. Every seconds. The ESP8266 queries the web service and starts to peep if the time to leave for the bus arrives..



ARTe architecture - arduino frameworkBeagleBoneBlack2 - arduino frameworkarduino debugging unit testing 1 - arduino framework

ARTe Arduino Real-Time extension | Home

.Net Micro Framework | Dragonfly Thing Works

Get started with Arduino and ESP32-DevKitC: debugging and …

official.arduino
2019-09-30T17:27:25+0000

“Nah Yeah Buoy” is a smart buoy system designed to identify rip currents near beaches, visualize their locations and movements, and provide alerts for lifeguards and swimmers.
safe image.php?d=AQBdqouv6Me27sHv&w=720&h=720&url=fbstaging%3A%2F%2Fgraph.facebook - arduino framework
official.arduino
2019-09-30T15:12:42+0000

Determine the RPM of a miniature steam engine using an Arduino, a potentiometer and an LED light source.
safe image.php?d=AQB3UwRuNvzpgO M&w=720&h=720&url=fbstaging%3A%2F%2Fgraph.facebook - arduino framework
d75EYy5j normal - arduino framework
Wolug
Sun Oct 06 06:56:12 +0000 2013


So einfach kann man viele Geräte am #Arduino ansteuern, und dazu braucht man kein Framework. Echo nach stty reicht. https://t.co/LDXQHdIat9

https://t.co/LDXQHdIat9
lBQ PgV3 normal - arduino framework
nmk4567
Sat Nov 07 21:37:43 +0000 2015


@TTownJoe @CopSub I think CSduino refers to their hardware, not software. So they may still be using the normal Arduino software framework, just on a custom board instead of an Arduino dev board.


2016-04-15T14:35:45



 photo

2016-04-15T14:35:40



 photo

2016-04-15T14:35:36



 photo
(Visited 23 times, 1 visits today)

About The Author

You might be interested in

Comment (46)

    1. Sie sind richtig: Ich habe Franzoesich accent!!
      Ich habe diese Link posted auf Microclub Facebook page, weil wir sind am diese chip zu studiren.

  1. Thank you for your excellent Tutorials, we have several ESP8266 and DA14580 BLE modules, LoRa module with FCC, CE certification, I wonder is it possible that you help me test these modules?
    Thank you for sharing valuable knowledge with us.
    It is really helpful for wirelss tech fans.

    1. I will only cover things I did not use before. So, if you have an innovative product, which is interesting for my viewers, I can integrate it in my mailbag, if you send me one

  2. i want to know how to get json data and make as a source json after send request elasticsearch

    #include
    #include

    //const char* ssid “Dialog 4G”
    //const char* “shehan@123”

    const char* ssid = “Crystal Martin Visitors”;
    const char* password = “cmcg@98765″;

    const char* serverAddress=”tracer-stg-lb1.southcentralus.cloudapp.azure.com”;
    const int serverPort=9200;
    void setup() {
    Serial.begin(9600);
    connectWIFI();

    }

    void connectWIFI(){
    Serial.println(“Try to connect wifi..”);
    WiFi.begin(ssid,password);
    while(WiFi.status()!=WL_CONNECTED){
    delay(100);
    Serial.print(“.”);
    }
    Serial.println(“Connected”);
    Serial.print(“IP Address-“);
    Serial.println(WiFi.localIP());

    }

    void myClient(){
    WiFiClient client;
    while(!client.connect(serverAddress,serverPort)){
    Serial.println(“Connection failed…”);
    return;
    }

    //Serial.println(“Connected..”);

    String url = “/esp/data/1 “;
    client.print(String(“GET “) + url + “HTTP/1.1\r\n” +
    “Host: tracer-stg-lb1.southcentralus.cloudapp.azure.com:9200\r\n” +
    “Connection: close\r\n” +
    “Content-Type: application/json\r\n” +
    “Cache-Control: no-cache\r\n” +
    “\r\n”);

    while(!client.available()){

    Serial.println(“Try…”);

    }
    client.readStringUntil(‘\n’);
    client.readStringUntil(‘\n’);
    client.readStringUntil(‘\n’);
    client.readStringUntil(‘\n’);
    client.readStringUntil(‘\n’);
    client.readStringUntil(‘\n’);
    client.readStringUntil(‘\n’);

    String str = client.readString();
    if (str.substring(77)){

    }
    Serial.println(str);
    StaticJsonBuffer<200> jsonBuffer;
    JsonObject& root = jsonBuffer.parseObject(str);

    if (!root.success())
    {
    Serial.println(“parseObject() failed”);
    return;
    }

    ////
    //// Step 3: Retrieve the values
    ////
    const char* factory = root[“factory_id”];
    const char* line = root[“line_id”];
    const int id = root[“device_id”];
    const char* time = root[“cycle_time”];
    //
    //
    Serial.println(factory);
    Serial.println(line);
    Serial.println(id);
    Serial.println(time);

    //
    //
    // Serial.println(response);
    // Serial.print(“Closing connection. “);

    }

    void loop() {
    myClient();

    }

    this is my code but did’n get separate each value

    1. ya I found new way elasticsearch feature ex GET/esp/data/_source then server return source only json format.as I think this is the best was….

  3. Nice video! Two additional hints that were not mentioned but might be helpfull:
    1. Some webtechnologies allow you to choose in which format you want the HTTP Reply by adding .xml or .json at the end of the uri.
    2. Use yield() instead of delay(1). This allows the scheduler to switch context (and do WiFi stuff) without the break.

    1. (1) Thanks for the tip. Unfortunately, I do not (yet?) know a lot about web technologies. So, I have to use what is available as services. I am not able to create my own…
      (2) I know the difference between yield and delay and if I used delay, it usually had a reason (even if I do no more remember, why). Normally, as you wrote, yield is the one to use.

  4. Marvellous Andreas, always steered clear of Web Service API’s, but will now dive into the IOT and see what I can find! Many thanks, keep up the grand work….

  5. I know this video is a bit old, however I´m hoping you will get this message anyway. I recently bought a bunch of stuff from china, Nevertheless I think I might have messed my self up trying to be cheep. I bought a few of these things and similar {links below}. Who knows maybe I´m not the only person to make this mistake (assuming it was a mistake).
    Link 1: https://www.aliexpress.com/item/Adapter-for-Nodemcu-Lua-USB-32M-ESP8266-ESP-12E-F-CP2102-Internet-Wifi-Module-DC-Power/32837635356.html
    Link 2: https://www.aliexpress.com/item/ESP8266-ESP12E-ESP12F-WIFI-Internet-Development-Board-CH340G-Blue-ESP-12E-ESP-12F-Adapter-Compatible-For/32841023309.html
    Are these just boards that I am supposed to solder Esp12f (or similar) boards onto? Or are these boards full fledged NodeMcu modules already and I´m just over thinking things? I think I went to cheep for my own good and messed myself up.
    Anyway I love you channel. You really help fools like myself out a lot.Please keep up the great work. BTW If I do need to add another board to these should I get the 12f? Also what is the latest and greatest micro-controller It seems to change daily?

    1. You are right, you have to solder modules on them. I do not know these boards, so I do not know if they work after soldering an ESP of them. I use ESP8266 and ESP32 boards. But there are many other chips around I do not know of.

    2. I think audible plays YouTube people who advertise for them (but I’m not sure). I assume it’s kind of like Amazon’s system where if someone buys something then you get a commission. If you are a part of the system and just don’t drown us in advertising for them then (first off thanks for not ramming it down our throats every video, second) please give me a link because I’m thinking about signing up. I would like you to get the commission. (Also do you know the answer to my question above? )

    1. Maybe you check again the installation instructions. Delete everything you installed for the ESP8266 and start over

  6. Ok.. for future reference.. beeps that loud, repeated more than once or twice, are AnNoYiNg!!!! And then it got faster!.. eesh…

  7. Thank you for sharing with us all this information , unfortunately I’m a beginner that starting to explore it. I’m trying to follow your ESP8266 videos and I’m missing one basic part which is what are the type of models we have ? which one to buy? how to define and connect it to the arduino IDE some basic stuff, I’m sorry if i missed such and can u please direct me to such information?

    1. This channel usually does not cover the basics. I am sure you find this information by googling. There are a ton of videos on how to start with the ESP8266.

  8. Dear friend, I hope you continue helping people the way you do on these videos, I just found your videos in 2019 and they really help me with some projects I have for my home city! Thank you!

  9. Hello Andreas I hope you can help me. I’m using a ESP8266 an my problem is that yesterday my code worked perfectly, then made some changes on some conditions and now I still can upload both codes, and create a server in which I can interact but neither the new nor the old code turns the relay on and won’t send info to the serial monitor.

    1. @Andreas Spiess Thanks again for answering 😉 just found it was the board type LOLIN (WEMOS) D1 R2 & mini instead of WeMos D1 R1. Don’t really understand the difference but I’ll search for it. Thanks again!!

    1. I noticed this Andreas.
      What I meant is if you tested that, really, the esp 8266 runs at 160MHz …
      Unfortunately my pocket oscilloscope (very useful) does not reach 160MHz.

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *