» Electronics » Arduino »Client for openweathermap.org based on Wemos d1 mini

Client for openweathermap.org based on Wemos d1 mini


The idea is borrowed from the project. ESP8266 Weather Display.

I decided to bring it to mind.
The following tasks were set:
  1. Update usage related code new version libraries ArduinoJson.h.
  2. Rewrite the code using the millis () function instead of the delay () function. It is clear that using delay to set a pause between changing information on the display, it is impossible to implement button controls;
  3. Make download sketches via Wifi;
  4. Get away from the bulky Wemos D1 R2 on the Wemos D1 mini;
  5. Whenever possible Russify display;
  6. Use a ready-made case with button holes for devices based on LCD1602;
  7. Use standard 6x6 buttons soldered to the breadboard. Add backlight control buttons, a carousel button for changing the displayed data and a button for forcing data updates from the server.


The following components were used:
  1. The case is made of ABS plastic with a set of covers for the buttons;
  2. Nylon struts 6 + 5 mm male M3 black, 4 pcs;
  3. M3 nylon nuts black, 4 pcs;
  4. Nylon posts 6 + 5 mm male M2 white, 3 pcs;
  5. Nylon stand 6 mm mother white, 1 pc;
  6. Nylon stand 8 mm mother white, 1 pc;
  7. Nylon racks 10mm mother white, 2 pcs;
  8. LCD 1602 (I2C), yellow;
  9. Wemos d1 mini;
  10. Wemos d1 DC-Power shield;
  11. Board breadboard 3x7;
  12. Buttons 6x6, height 7 mm, 3pcs;
  13. Dupont wires 10cm mother-mother, 4 pcs;
  14. 24 AWG wires black and red;
  15. Silicone wires 20 AWG blue and white;
  16. Resistors 5 kOhm - 2 pcs, 10 kOhm - 1 pc (which came to hand);
  17. Power adapter 9V 1A;
  18. Two-component epoxy adhesive.


The used case has several advantages. Firstly, in addition to the display, the standard 3x7 standard decoupling board with its components installed on both sides is perfectly placed in height. Secondly, at two ends it has rectangular openings for cooling. It turned out that the jumpers between these holes are perfectly cut by mini-files 3 and 4 mm. If you cut a couple of jumpers and cut a small rectangular hole in the case, then the DC-005 power connector goes perfectly into the formed hole of complex geometry. Also, the back of this case has a large square hole, which, apparently, was supposed to install batteries.Through it, it is convenient to connect something inside without disassembling the case. Subsequently, it can simply be closed with glass or plastic.

Build progress:
First, a prototype was made on a breadboard.

Then the case is finalized with a file.

After that, the main components are soldered and the fitting is carried out. The legs were specially bent so that the detachable joints fit in height. A couple of nylon racks had to be filed so that all the buttons were at the same height.




As a result, the front side of the board with buttons, resistors and wires is as follows:

As a result, the insides of the device look like this:

When assembled, the device looks like this:





Overcoming difficulties:
  1. For a long time I could not understand why the buttons did not work, although the multimeter clearly showed 0 when the buttons were pressed and 4.6 - 5.0 V when pressed (depending on the power supply). It turned out that in Wemos / Lolin devices it is necessary to indicate GPIO numbers as pin numbers in the sketch. For example, D5 is GPIO14. So this is the 14th pin.
    const int buttonPin = 14;

  2. To show the weather, the condition is necessary:
    currentMillis - previousMillis == weatherTime

    Strict correspondence, because it must be done once.
    To make a request to the server, the condition is necessary:
    currentMillis - previousMillis> = getDataTime

    Loose compliance, because it is executed until the “data received” flag is set.
    In fact, this is not obvious, and to understand this, it took quite a long time.
  3. I also had to torment myself with the server's response:
    String weather = root ["weather"] [0] ["main"];
    String description = root ["weather"] [0] ["description"];

    Zero was completely unobvious. It turns out that there are two weather stations in Moscow, and the second of them does not always work (to receive data from it, you must specify [1] if it is active).

The repository with code and libraries is located here.
5.5
8.5
10

Add a comment

    • smilesmilesxaxaokdontknowyahoonea
      bossscratchfoolyesyes-yesaggressivesecret
      sorrydancedance2dance3pardonhelpdrinks
      stopfriendsgoodgoodgoodwhistleswoontongue
      smokeclappingcraydeclarederisivedon-t_mentiondownload
      heatirefullaugh1mdameetingmoskingnegative
      not_ipopcornpunishreadscarescaressearch
      tauntthank_youthisto_clueumnikacuteagree
      badbeeeblack_eyeblum3blushboastboredom
      censoredpleasantrysecret2threatenvictoryyusun_bespectacled
      shokrespektlolprevedwelcomekrutoyya_za
      ya_dobryihelperne_huliganne_othodifludbanclose
7 comments
ino53, it is surprising that we met in absentia, reading an article not about amplifiers and BP. Although not surprising. And about a year I guessed for a long time. I'm 67, but that's not the point.
Thank you, I will know about a good thing.
Guys, my nickname is the initials and the year of birth, 1953. I have 42 years of engineering experience in my work record, I don’t know about amateur - dad (not Lukashenko, we don’t have gypsies), said that I started to grab the soldering iron before talking. I did not understand anything written, but this is a step further, well done.
Author
I do so. In turnip http: //arduino.esp8266.com / stable / package_esp8266com_index.json has support for these boards.
And you can program using one Arduino IDE?
Author
Well, I personally ordered two Wemos D1 R2 v2.1.0 boards a year ago (they work with the cp210x driver). And two Wemos d1 mini half a year ago. One of the D1 R2 came with a fallen off resistor from a 12 volt supply circuit. Well, I looked at the circuit, found a resistor, soldered, it worked. Otherwise, I have not noticed any problems yet. In terms of popularity, it is approximately like NodeMCU, it is strange that they have not heard.
I learned about Wemos from your article, the price and features are attractive, but what about durability?

We advise you to read:

Hand it for the smartphone ...