Browse over 10,000 Electronics Projects

Presepino: the nativity scene with Arduino

Presepino: the nativity scene with Arduino

The two auxiliary outputs are OUTEX1 and OUTEX2.

Circuit diagram

Let’s get down to details now, by analyzing the circuit, that is based on the ATmega 328 microcontroller, on which the dedicated sketch is running: the latter implements the control of the outputs and of the module implementing the nativity scene’s sound, and that at the initialization sets PB0 as the output used for sending the serial commands to a possible Neopixel strip, and PB1, PB2, PB3, PD3, PD5, PD6 as outputs for the control of the MOSFET outputs to channel N (the transistors are some sturdy STP36N06s, having an Id of 36 ampere and a Vdso of 60V) that materially commute the power to the corresponding LEDs or LED strips. Each one of the microcontroller’s lines that are used in order to manage the outputs also pilots its own MOSFET’s gate, by means of a 1 kohm resistor; and between the gates and ground some LEDs are applied: they allow, by lighting up, to monitor the state of the corresponding transistor. Each one of the outputs supplies rectangular TTL-compatible pulses, that have constant frequency and are width modulated, by means of the PWM technique: this enables the variation of the average value of the voltage applied by the MOSFETs to the loads related to them, and consequently, of power and luminosity. This is carried out with a very high efficiency, since the MOSFET’s electrical resistance while in ON state (fully conductive) is a very low one and thus the dissipated power (the power transferred being equal) is a very limited one, if compared to the one that would come from a series piloting that uses DC voltage, in which the transistor would have to take upon itself the difference between the power supply voltage and the one applied to the load.

The current circuital configuration takes into account to power the LED strips by connecting their positives and negatives respectively to the + and – of the corresponding output. However, since the MOSFETs may “withstand”  up to 60 volts of drain-source voltages in the interdiction, it may be conceivable to start from an external power source even at 24÷36 volt of direct current, so to decrease the absorption (the electric power managed being equal). If the power is not taken from the circuit, the LED strip will have to be connected, with the + going to the chosen power supply’s positive and the – going to our control box’s output, it being understood that the power supply’s ground and the board’s one must be joined.

 

1230_Schema



Advertisement1


We previously claimed that the complete sequence that is generated by our circuit is composed of four phases (day, sunset, night and dawn), whose duration may be independently regulated by means of the dedicated trimmers, that are connected to a potentiometer and powered at 5V, and whose pointer’s voltage is read by a microcontroller’s I/O, which is configured as an input and acquired by means of the A/D converter that is found within the ATmega microcontroller. In our project, the ADC is assigned to the PC0÷PC5 lines, with which the voltages of the six trimmers (that is to say, R1, R2, R3, R4 for the said functions, and R5 and R6 for the functions that we will assign to the optional outputs – respectively being OUTEX1 and OUTEX2 – that supply PWM signals, exactly as the four basic ones do) are acquired via scan. For the way the firmware has been structured, the duration of the respective cycles is directly proportional to the voltage applied to the corresponding trimmer, thus – for example – by bringing R1’s pointer towards ground, the duration of the day is reduced, while it is instead increased by bringing it towards the 5V’s positive. The PWM signals are generated by the PWM modules that are internal to the microcontroller, opportunely set by the firmware for each output.

Please pay attention to a detail: while the trimmers R5 and R6 directly control the PWM of the OUTEX1 and OUTEX2 outputs, in the sense that they directly act on them, the other four determine the cycles’ times and don’t do it directly for the duty-cycle of the PWM signals to the SOLE, STELLE, COMETA and FUOCO outputs; the PWMs and their periodicity are managed by the firmware’s subroutines (the ones dealing with the four phases, whose functioning depending on the time is defined by the voltages supplied by the R1, R2, R3, R4 trimmers). This functioning is a logical one, since the described phases involve more than one output and, in the case of the day/night transition, they specifically involve the SOLE and STELLE outputs, that fade out – as it is also with the night/day passage.

The trimmers from R1 to R4 are thus needed in order to manage the duration of the day (R1), of the night (R2), of the dawn (R3) and of the sunset (R4). The LD6 LED is briefly turned on when passing from a phase to another one.

The duration of each single phase is set by means of the dedicated trimmer; the maximum duration of each phase is of about 100 seconds; for the sake of precision, the duration is obtained by the ADC reading on 10 bits (between 0 and 1.023), considered in milliseconds and multiplied by 100 by the firmware. If you want different times, you may edit the sketch in the section dealing with the determination of the functioning on the basis of the time.

Pages: 1 2 3 4 5 6

 


Top