Description: This random timer circuit is based on an Atmel ATTINY24 AVR driving one power relay. It can be used to switch on and off other circuits randomly. For instance, in a model railroad setup, this circuit can activate and deactivate parts of animated or moving scenery to enhance the visual experience. The circuit is designed for a modular model railroad, featuring various flashing lights on ambulances, police cars, and fire engines. These lights are continuously operational, and this circuit aims to engage visitors at model railroad exhibitions with more dynamic action. The schematic of the random timer circuit is organized into several functional blocks. The power supply block stabilizes the 12V input and protects against reverse polarity. A standard 7805 voltage regulator supplies 5V to the microcontroller. The input block comprises three potentiometers and one button. The potentiometers are used to configure the on and off times, as well as the random time interval. ADC0 is connected to the potentiometer that adjusts the random time between 0% and 500% additional time. ADC1 sets the off time between 1 and 60 seconds, while ADC2 adjusts the on time in the random timer circuit. The button is included for aesthetic preference and does not serve a functional purpose. The prototype of the random timer circuit was developed using another board (the tiny DCC decoder for 8 LEDs), which already had the button integrated.
The processor block is responsible for all calculations. The ATTINY24 reads the inputs and computes the on and off times for the random timer circuit. It contains a program with predefined random numbers generated using an online random number generator. Although these numbers are predefined, they suffice for the circuit's purpose. When duplicating the circuit with the same hex file programmed into another microcontroller, both units will initially exhibit synchronized randomness. However, due to the unstable internal RC oscillator, they will gradually drift in clock speed, appearing random over time. The output block includes a relay controlled by a transistor, with the transistor's base connected to the microcontroller. This prototype is designed as a single-channel random timer circuit, but the ATTINY24 microcontroller has five unused pins that could be configured for a six-channel random timer circuit. Some components used differ in type but maintain the same functionality; for instance, the 7805 can be replaced with an AMS1117, and the transistor driving the relay is an SMD 2N2222. A red 5mm LED is connected to the random timer circuit to indicate when the relay is activated.
The circuit employs a microcontroller programmed with an algorithm that generates random timed intervals for activating the relay. The ATTINY24's ADC (Analog-to-Digital Converter) is utilized to read the values from the potentiometers, which allow users to set specific timing parameters. The use of a relay enables the circuit to control higher power loads, making it suitable for applications beyond model railroads, such as controlling lights or motors in various electronic projects.
The design ensures that the microcontroller operates efficiently with minimal power consumption, utilizing power-saving features and interrupt-driven programming. The timer interrupt is configured to trigger every 100 milliseconds, allowing the microcontroller to manage tasks without continuous polling, thus optimizing performance. The implementation of a random number generation algorithm enhances the unpredictability of the relay activation, contributing to a more engaging experience in applications such as model railroads, where dynamic scenery is crucial for capturing the interest of viewers.
Overall, this random timer circuit offers flexibility, allowing for customization in various applications while maintaining a straightforward design that can be easily replicated or modified for different use cases.This random timer circuit is based on a Atmel ATTINY24 avr driving one power relay. You can use this circuit to switch on and off other circuits randomly. For example, when using this circuit on a model railroad you can turn on and off parts of the animated or moving scenery to create a more dynamic view. This circuit was designed to be used on a modular model railroad. This model railroad contains different flashing light on ambulances, police cars and fire engines. These lights are on all the time, with this circuit I hope to keep visitors of a model railroad exposition more interested while watching all the action. The schematic of the random timer circuit is divided into different functionality blocks. The power supply block stabilizes the 12V and protects the power input for reverse polarity. There is a standard 7805 voltage stabilizer to supply 5V to the microcontroller. The input block consists of 3 potentiometers and one button. The potentiometers can be used to configure the on and off time, and the amount of random time. ADC0 is connected the the potentiometer which configures the amount of random time between 0% and 500% extra time.
ADC1 configures the off time between 1 and 60 seconds. ADC2 configures the on time in the random timer circuit. The button is there just because I like buttons, it has no functionality. Actually, the prototype of theG‚random timer circuit I made was using one of my other boards ( the tiny dcc decoder for 8 leds ), this board already has the button, so there you go. The processor block is where all the math takes place. The ATTINY24 reads the inputs and calculates the on and off times in the random timer circuit. The ATTINY24 contains a program with predefined random number generated with my online random number generator.
These random numbers is what makes this circuit random. You might say that when it is predefined these random numbers aren`t really random, yes, but for the purpose of this circuit is works just fine. Even when duplicating this circuit and programming the same hexfile into another microcontroller they both seem random.
In the beginning they will be somewhat synchronized random, but because of the unstable internal RC oscillator they will drift over time in clock speed and then they both appear to be random. Lastly the output block contains a relay which is driven by a transistor. The transistors base (input) is connected to the microcontroller. I have chosen for this prototype to be a 1 channel random timer circuit, but the ATTINY24 microcontroller has 5 pins unused which can be combined into a 6 channel random timer circuit.
There are some parts used that are different in type, but are still have the same functionality. The 7805 is AMS1117 and the transistor that drives the relay is a SMD 2N2222 (on the bottom). You can see I connected a red 5MM led to the random timer circuit so I can see when the relay is switched on. /* * AvrStudioRandomTimer. c * * Created: 13-12-2012 21:30:06 * Author: Marc, */ #include #include #include #include #include #include "random. h" //Used for programming the production ELF file. LOCKBITS = LB_MODE_3; //Further programming and verification disabled FUSES = {. low = (FUSE_CKSEL3 & FUSE_CKSEL2 & FUSE_CKDIV8 & FUSE_CKSEL0 & FUSE_SUT0), //Internal 8MHz rc oscillator, CKDIV8, 64ms startup time.
The BC547B transistor has a collector-base voltage (Vcbo) of 50V, a collector-emitter voltage (Vceo) of 45V, and an emitter-base voltage (Vebo) of 6V. In contrast, the BC548 transistor in the original circuit has a Vcbo of 30V, a Vceo of...
This instrument requires two precision components: A precision capacitor and a precision inductor. You only need to start with one precision component, either the reference capacitor or the reference inductor, and using this meter, you can select or adjust the...
The lamp relay delay circuit is illustrated in Figure 7. Components S131 and SB2 are light buttons mounted in different locations. The lamp can operate with F. LEDs (LED1 and LED2) should be installed in SB1 and SB2 to indicate...
The schematic indicates that the AccelR8 utilizes only three integrated circuits (ICs). An AVR 8515 microcontroller performs the computational tasks and manages the other circuits. A MAX603 regulates voltage and controls the power-on and power-off functions. The key component enabling...
220V mains electricity is sent through a 0.33 µF capacitor (Ci) and a 50 kΩ resistive drop. A bridge rectifier composed of diodes D1 to D4 converts the AC voltage to DC. After passing through a 100 µF capacitor for...
AVRDude is a program designed for burning hex code into microcontrollers. USBasp is a USB-based programmer for AVR microcontrollers. This tutorial will demonstrate how to use AVRdude to burn hex files into an AVR microcontroller using USBasp. The AVRdude software...
As a fully-featured Linux computer, many external programmers can be used with the Raspberry Pi to program the Atmel AVR range of microprocessors. It is also possible to utilize the general-purpose input/output lines (GPIOs) found on the Raspberry Pi to...
This is likely the simplest digital voltmeter utilizing an Atmel AVR microcontroller and an LCD display. The circuit is managed by a microprocessor IO1 - AVR Atmel ATmega16A, ATmega16L, ATmega16, ATmega32A, or ATmega32. A program is available for free download...
A relay is controlled by a closed circuit in a digital logic setup, utilizing a touch input switching circuit.
The described circuit involves a relay that operates based on a closed circuit condition within a digital logic framework. The relay serves...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more