Directory of RSS feeds
Statistics

RSS feeds in the directory: 374

Added today: 0

Added yesterday: 0

Hi-Tech / Hardware

Universal watchdog timer ATtiny13

Samopal.pro 04.04.2019 at 16:58

External watchdog timer is a crutch for bad developers who can't develop a normal working program for the microcontroller, or steadily working the scheme.

The more built-in WDT is available in most modern microcontrollers.

But there are times when you have to deal with prepared Board or module with defined problems. Your first WDT I did to combat rare, but still happening sometimes freezes ESP8266. And then a soft-reset is not saved and ESP-shka didn't want to reconnect to WiFi. Distortion power external WDT solved the problem.

the Second problem arose with GSM controller Elecrow ATMEGA 32u4 A9G. Here was the place to be very rarely occurring freeze of the SIM card. (By the way, this same problem happens with USB modems 3G and 4G). To combat this freeze need to juggle food on the SIM card. And it seems even the output from a GSM modem for this, but in the circuitry of the device this feature is not incorporated. And for maximum reliability had to go back to the outside guard dog.

the Diagram on the 555 timer I decided not to repeat. Too many flaws she revealed:

Large dimensions and a lot of strapping an Uncomfortable setting the operating time trimmer for Quite a long reset time (the necessary discharge of a capacitor) and a potential hanging MK with a low level timer output when the timer just stops firing.

And open Source projects on the Internet that meet my requirements, I have not found. So destiny to do everything yourself

the Requirements for a new WDT Low price of the device, ease of fabrication and small size, Control periodic change of the logic level at the input 0/1 Easy setup the response time (as the selection of the preset intervals) the Development of iron

as the main chip chose the ATtiny13 microcontroller. Its capacity was more than enough for my tasks. And the price, taking into account the reduction of the piping is practically the same as the 555 chip.

Five conclusions MK (RESET decided not to touch) were the following:

Output timer Input to reset the Three remaining o — time tripping

For switching power supply uses a P-channel MOSFET. You can use any compatible body, but it is advisable to take the so-called "logical levels" — that is fully operable from a low voltage of 3-5V: IRLML2502, AO3415, etc. Despite its small size, this transistor is able to drive the load at 4A. If you want to switch to something else, this output can be directly connected the relay to 5V.

the Led lights up at the time of the timer and deactivate the main unit.

the Main connector to the microcontroller Board has four output

General bus Input reset Output +5V (controlled by timer) Input +5V

Two connector — ICSP programmer and the jumpers power supply can not establish on the Board. To flash the microcontroller in the programmer in advance, and the response time constant to set the jumper.

the List of components MK Attiny13-SSU ~ $0.3 (if you buy 10 pieces) MOSFET P-channel IRLML5203 — $0.09 (50pcs) or MOSFET AO3415 — $0.05 Resistor 1K Resistor 470 SMD1206 SMD1206 1206 Led of any color Connectors PLS-6 PLS-3 and PLS-4R (PLD-3 and PLS-4R) is normally cut off from the long combs Manufacturer

Board to get small — 18×22 mm. I spread two options:

For one-sided fabrication Loot

For order plant with improved design and navigation between the parties. (Order from the Chinese, with case)

Firmware

I Programmed in the environment of ArduinoIDE installed support for Attiny13 — MicroCore. In the latest version of the IDE was the problem of the programmer ArduinoISP, but work properly in the Arduino IDE version 1.6.13. To understand that there was something wrong Naitonal friendly team arduino.cc did not have the desire )))

Tinku set up to work from the inside of the resonator with a frequency of 1.2 MHz. The program is easy — configurable inputs/outputs, read PB2 to PB4 and the designated response time, adjustable timer and goes into the IDLE. The timer interrupt designated as control input. If the status is changed to the opposite, reset the counter. If the counter exceeds the set response time — twisting power output.

#define F_CPU 1200000UL

#include

#include

#include

boolean pb1_state;

volatile uint16_t pb1_count;

// the interrupt Handler for the TIMER0 timer

ISR(TIM0_OVF_vect){

pb1_count++;

}

int main(){

// Set PB0 output

DDRB |= (1

Other feed items

Connect soil moisture sensors to MajorDoMo 26.01.2019 at 07:01