hardware wdt or software wdt is better in esp8266?

i am doing a project where i am posting sensor data using dht11 and esp8266 to cloud. i know that esp8266 has two wdt(watch dog timer) i.e. hardware and software. i want to include the wdt in the program.

But i am confused that which will be better to use? software or hardware? 

Circuit Digest 16 Jul 08:48

Tutorial – Arduino and Four Digit Seven Segment Display Module

This is a quick start guide for the Four Digit Seven Segment Display Module and Enclosure from PMD Way. This module offers a neat and bright display which is ideal for numeric or hexadecimal data. It can display the digits 0 to 9 including the decimal point, and the letters A to F. You can also control each segment individually if desired. 

Each module contains four 74HC595 shift registers – once of each controls a digit. If you carefully remove the back panel from the enclosure, you can see the pin connections:

If you’re only using one display, use the group of pins at the centre-bottom of the board. From left to right the connections are:

  1. Data out (ignore for single display use)
  2. VCC – connect to a 3.3V or 5V supply
  3. GND – connect to your GND line
  4. SDI – data in – connect to the data out pin on your Arduino/other board
  5. LCK – latch – connect to the output pin on your Arduino or other board that will control the latch
  6. CLK – clock – connect to the output pin on your Arduino or other board that will control the clock signal

For the purposes of our Arduino tutorial, connect VCC to the 5V pin, GND to GND, SDI to D11, LCK to D13 and CLK to D12. 

If you are connecting more than one module, use the pins on the left- and right-hand side of the module. Start with the connections from your Arduino (etc) to the right-hand side, as this is where the DIN (data in) pin is located.

Then connect the pins on the left-hand side of the module to the right-hand side of the new module – and so forth. SDO (data out) will connect to the SDI (data in) – with the other pins being identical for connection. 

The module schematic is shown below:

Arduino Example Sketch

Once you have made the connections to your Arduino as outlined above, upload the following sketch:

// Demonstration Arduino sketch for four digit, seven segment display with enclosure
// https://pmdway.com/collections/7-segment-numeric-leds/products/four-digit-seven-segment-display-module-and-enclosure
int latchPin = 13; // connect to LCK pin intclockPin = 12; // connect to CLK pin intdataPin = 11; // connect to SDI pin int LED_SEG_TAB[]={ 0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6,0x01,0xee,0x3e,0x1a,0x7a,0x9e,0x8e,0x01,0x00}; //0 1 2 3 4 5 6 7 8 9 dp . a b c d e f off void setup() { //set pins to output so you can control the shift register pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); } void displayNumber(int value, boolean leadingZero) // break down "value" into digits and store in a,b,c,d { int a,b,c,d; a = value / 1000; value = value % 1000; b = value / 100; value = value % 100; c = value / 10; value = value % 10; d = value; if (leadingZero==false) // removing leading zeros { if (a==0 && b>0) { a = 18; } if (a==0 && b==0 && c>0) { a = 18; b = 18; } if (a==0 && b==0 && c==0) { a = 18; b = 18; c = 18; } if (a==0 && b==0 && c==0 && d==0) { a = 18; b = 18; c = 18; d = 18; } } digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[d]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[c]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[b]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[a]); digitalWrite(latchPin, HIGH); } void allOff() // turns off all segments { digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, 0); shiftOut(dataPin, clockPin, LSBFIRST, 0); shiftOut(dataPin, clockPin, LSBFIRST, 0); shiftOut(dataPin, clockPin, LSBFIRST, 0); digitalWrite(latchPin, HIGH); } void loop() { for (int z=900; z<=1100; z++) { displayNumber(z, false); delay(10); } delay(1000); for (int z=120; z>=0; --z) { displayNumber(z, true); delay(10); } delay(1000); digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[14]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[13]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[12]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[11]); digitalWrite(latchPin, HIGH); delay(1000); digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[16]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[15]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[14]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[13]); digitalWrite(latchPin, HIGH); delay(1000); digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[0]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[1]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[2]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[3]+1); digitalWrite(latchPin, HIGH); delay(1000); digitalWrite(latchPin, LOW); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[7]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[6]+1); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[5]); shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[4]); digitalWrite(latchPin, HIGH); delay(1000); }

After a moment you should see the display spring into action in the same way as in the demonstration video:

How does it work? 

First we define which digital output pins are used for latch, clock and data on lines four to six. On line eight we have created an array which contains values that are sent to the shift registers in the module to display the possible digits and letters. For example, the first – 0xfc – will activate the segments to display a zero, 0x7a for the letter C, and so on. 

From line 20 we’ve created a custom function that is used to send a whole number between zero and 9999 to the display. To do so, simply use:

void displayNumber(value, true/false);

where value is the number to display (or variable containing the number) – and the second parameter of true or false. This controls whether you have a leading zero displayed – true for yes, false for no. 

For example, to display “0123” you would use:

displayNumber(123, true);

… which results with:

or to display “500” you would use:

displayNumber(500, false);

… which results with:

To turn off all the digits, you need to send zeros to every bit in the shift register, and this is accomplished with the function in the sketch called 

allOff();

What about the decimal point? 

To turn on the decimal point for a particular digit, add 1 to the value being sent to a particular digit. Using the code from the demonstration sketch to display 87.65 you would use:

 digitalWrite(latchPin, LOW);

 shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[5]);

 shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[6]);

 shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[7]+1); // added one for decimal point

 shiftOut(dataPin, clockPin, LSBFIRST, LED_SEG_TAB[8]);

 digitalWrite(latchPin, HIGH);

… which results with:

In-depth explanation of how the module is controlled

As shown in the schematic above, each digit is controlled by a 74HC595 shift register. Each shift register has eight digital outputs, each of which control an individual segment of each digit. So by sending four bytes of data (one byte = eight bits) you can control each segment of the display. 

Each digit’s segments are mapped as follows:

And the outputs from each shift register match the order of segments from left to right. So outputs 0~7 match A~G then decimal point. 

For example, to create the number seven with a decimal point, you need to turn on segments A, B, C and DP – which match to the shift register’s outputs 0,1,2,8. 

Thus the byte to send to the shift register would be 0b11100001 (or 225 in decimal or 0xE1 in hexadecimal). 

Every time you want to change the display you need to re-draw all four (or more if more than one module is connected) digits – so four bytes of data are sent for each display change. The digits are addressed from right to left, so the first byte send is for the last digit – and the last byte is for the first digit. 

There are three stages of updating the display. 

  1. Set the LCK (latch) line low
  2. Shift out four bytes of data from your microcontroller
  3. Set the LCK (latch) line high

For example, using Arduino code we use:

  digitalWrite(latchPin, LOW);

  shiftOut(dataPin, clockPin, LSBFIRST, 0b10000000); // digit 4

  shiftOut(dataPin, clockPin, LSBFIRST, 0b01000000); // digit 3

  shiftOut(dataPin, clockPin, LSBFIRST, 0b00100000); // digit 2

  shiftOut(dataPin, clockPin, LSBFIRST, 0b00010001); // digit 1

  digitalWrite(latchPin, HIGH);

This would result with the following:

Note how the bytes in binary match the map of the digits and their position. For example, the first byte sent was for the fourth digit, and the segment A was turned on. And that’s all there is to it – a neat and simple display. 

This post brought to you by pmdway.com – everything for makers and electronics enthusiasts, with free delivery worldwide.

To keep up to date with new posts at tronixstuff.com, please subscribe to the mailing list in the box on the right, or follow us on twitter @tronixstuff.

 

Tronixstuff 13 Jul 08:48
arduino  display  led  numeric  pmdway  

A giant tide clock like no otter!

As a gift for friends that operate tours of Prince William Sound in Alaska, maker ‘rabbitcreek’ decided to make a humongous (4’ diameter) tide clock, controlled by dual Arduino Nanos. 

One Nano operates the adorable—though very large—otter on the clock’s face via a servo and gear reduction setup that holds a kayak paddle to indicate high and low tides. The other board handles the unit’s RGB LED lighting, which shines the appropriate color to indicate the vast swings in daylight time of that region.

An RTC module for each Nano provides accurate timekeeping—thus proper tide and daylight indications—and a small monitor is used for maintenance tasks. It’s a brilliant build that is certain to delight residents and tourists to the area alike!

How to stop/terminate a python script from running?

hi guys. i am running a python code on raspberry pi3. Everything is running well but only thing which is annoying me is the continuous running of the python program. for exiting from the python program i need to close the terminal window and open terminal again then locate to the folder and run the python program again. i know this cannot be the right way to do this and it is time consuming. what to do if i want to terminate the program withtin single terminal window. 

Circuit Digest 12 Jul 13:58

Lessons Learned From An Art Installation Build

Art installations are an interesting business, which more and more often tend to include electronic or mechanical aspects to their creation. Compared to more mainstream engineering, things in this space are often done quite a bit differently. [Jan Enning-Kleinejan] worked on an installation called Prendre la parole, and shared the lessons learned from the experience.

The installation consisted of a series of individual statues, each with an LED light fitted. Additionally, each statue was fitted with a module that was to play a sound when it detected visitors in proximity. Initial designs used mains power, however for this particular install battery power would be required.

Arduinos, USB power banks and ultrasonic rangefinders were all thrown into the mix to get the job done. DFplayer modules were used to run sound, and Grove System parts were used to enable everything to be hooked up quickly and easily. While this would be a strange choice for a production design, it is common for art projects to lean heavily on rapid prototyping tools. They enable inexperienced users to quickly and effectively whip up a project that works well and at low cost.

[Jan] does a great job of explaining some of the pitfalls faced in the project, as well as reporting that the installation functioned near-flawlessly for 6 months, running 8 hours a day. We love to see a good art piece around these parts, and we’ve likely got something to your tastes – whether you’re into harmonicas, fungus, or Markov chains.

A 3D-printed, Arduino Due-based MIDI jammer keyboard

Michael Koopman wanted to learn piano. However, after finding this pursuit frustrating, he instead decided to assemble his own 3D-printed MIDI jammer keyboard, inspired by the AXiS-49 interface pad. 

His instrument is controlled via an Arduino Due, with 85 buttons arranged in a diagonal pattern. This allows for whole steps on the horizontal axis, fourths on one diagonal, fifths on the other diagonal, and octaves on the vertical axis. 

This configuration enables the device to be used in a variety of ways, and features an additional six buttons and four potentiometers to vary playing style, along with ¼ inch jacks for auxiliary inputs. 

As seen in the video below, while Koopman had a hard time with the piano, apparently that wasn’t case with his MIDI keyboard, as he’s able to play it beautifully—even using two at a time around 8:15!

A fun Fibonacci clock for math fans

In the early 1200s, Fibonacci introduced a series of numbers that now bear his name, starting with 0, then 1, and continuing on as the sum of the two preceding numbers. This gives values of 0, 1, 1, 2, 3, 5, 8, and so on, and after being prompted by a friend, “TecnoProfesor” decided to turn this numerical pattern into a clock.

The concept here is that instead of using the conventional 1-12 to display the time, this device uses blocks corresponding to Fibonacci numbers 1-5, with circular icons adding increments of 12 for minute and second values. 

It’s an interesting concept, somewhat akin to the world of binary or even word clocks. The build consists of an Arduino Mega and a DS3231 RTC module for control, a wood and methacrylate housing, and a number of programmable RGB LEDs to indicate numbers.

A custom Mazda MX5/Miata TFT cockpit gauge cluster

Nearly any car comes with the proper dashboard to get you from point A to point B, but what if you want something all your own displaying important stats? While there’s not a lot of technical info on the build, Jroobi’s MX5/Miata Arduino-based TFT cockpit project is sure to inspire, whether via the first or second iteration shown below.

The first version puts RPM and KPH values on coaxial sliders in the right circular display. That leaves the second round display for info such as what gear you’re in, along with auxiliary displays for extra data. The second splits up RPM and KPH between the main circles. It also features interesting light-up alerts in the middle, as well as a gauge similar to the first on the top. 

The first iteration—and presumably the second—includes a clever user interface setup, where a rotary encoder surrounds the existing trip reset button for brightness control while still preserving its reset ability.

This color wheel instrument lets you ‘hear’ the rainbow

How we see colors is an interesting concept, and as a conversation starter about the physics of color and sound, maker Marcin Poblocki created his own ‘Color Instrument.’

Poblocki’s device rotates a wheel of colors around under a TCS3200/TCS230 sensor via a continuous rotation-modded SG90 servo motor. An Arduino Nano then spits out the tone corresponding to the color it senses using a small speaker, allowing for simple songs to be produced according to hue arrangements. 

It’s a neat idea that could be taken in many different directions. At the very least, it would certainly spark conversation, perhaps questioning, as noted in the project write-up, why the color pink isn’t included in the natural light spectrum.

Arduino Blog 10 Jul 19:25

Unique Clock Keeps Time the Fibonacci Way

You say your binary clock no longer has the obfuscation level needed to earn the proper nerd street cred? Feel like you need something a little more mathematically challenging to make sure only the cool kids can tell the time? Then this Fibonacci clock might be just the thing to build.

Granted, [TecnoProfesor]’s clock is a somewhat simplified version of an earlier version that was nigh impossible to decode. But with its color coding and [Piet Mondrian]-esque grids, it’s still satisfyingly difficult to get the time from a quick glance. The area of the blocks represents the Fibonacci sequence 1, 1, 2, 3, 5, and adding up which blocks are illuminated by the RGB LEDs behind the frosted front panel. That lets you tally up to 12 intervals; for the minutes and seconds, there are indicators for the powers of 12 up to 48. Put it all together and you’ve got a unique and attractive graphical time display that’s sure to start interesting conversations when the mathematically disinclined try to use it. Check out the video below as the clock goes from 12:28:01 to 12:28:46. We think.

If this doesn’t scratch your itch for obfuscated clocks, we’ve got plenty of them. From random four-letter words to an analog digital clock to an epic epoch clock, we’ve got them all.