How boring, how boring, how boring, How boring: final smash a beloved couple who sadly no more.
In these days of forced seclusion serves industriarsi to spend the day in addition to reading printed newspapers or on tablets and prepare lunch and dinner maybe in a more elaborate and limited to a few minutes of air on the balcony or four steps to go to the grocery store.
Perhaps yours is more fortunate than many others: living in a mountain village in tourist (3 months a year !) I have almost everything at your fingertips: supermarket to the baker newsstand.
Il progetto che mi accingo a presentare inizia ancora ai primi di febbraio quando i TG vari cominciavano a dare risalto a quello che stava succedendo in Cina. L’idea nasce ancora a Natale dello scorso anno e tra i vari addobbi natalizi c’erano tre stelle a dieci punte abbastanza grandi e colorate dai classici festoni natalizi a uso decorativo. Come in questa figura:
I had thought of as raising the profile of these stars, but then got other commitments I just shelved until early February. And here is the end result: (for example only).
DEFINITION OF PROJECT
The structure of the star (metal frame) as you can see from the above photo is composed of ten segments willing to precisely form a star: each segment is around 10 cm. The total height from the tip to the bottom is about 30 cm and the maximum width is almost 40 cm.
How to make light ?:
At first (always at Christmas) using a wire microled (those found by the Chinese just around Christmas) montati su un filo smaltato in serie tra loro e alimentati a 3V, It was wrapped between a segment and the other: It was not very bright but something demonstrated.
In light of everything I thought what could be the system to make them more visible and choreographic. And especially (professional deformation) un sistema programmabile e il più economico possibile.
Then pulling out of the "electronic" has jumped out drawer:
A good number of LED RGB (type WS2812) used in digital still maxi_orologio construction presented at the time. I had bought almost 200 as between tests and various disasters I had consumed more than 100. Only maxi_orologio it takes away 112.
A pair of Atmega328 (those mounted on Arduino_1) as individual chips, a couple of Arduino_Nanoe miscellanea varia tra condensatori, quartz, power supplies, etc.
A conti fatti il materiale può essere sufficiente e quindi ho iniziato a studiare il progetto.
I state that the solution is just my own bag: definitely improved from all points of view is the one that what electronic constructive. But being impulsive nature of what I first to pass through the head is what then try to realize without thinking much.
Here's what you thought and realized:
In each segment of the star (10 segments) is inserted into a board that houses 5 led WS2812cablati in un piccolo PCB. Why use these LEDs ? (beyond them at home). Simple with a single wire (+ supply) it is possible to connect in series a virtually unlimited number of LEDs with a single foresight: a good minimum 1A 5V power supply but dependent on how many LEDs are connected. And each is individually addressable. I will not dwell on the characteristics of these LEDs and I invite you to read the article on maxi_orologio entitled "A wire for a watch”.
then start with the production of a first PCB (Number 1).
This PCB compared to the following 9 R presents a da 330 ohm entrance of the pin DATA_IN the first LED of the whole chain. After the last led a capacitor 100000pf of VCC / GND. I successivi PCBNON They have this resistance as being necessary only at the beginning of the chain. To accommodate these firmly to the PCB segments of the star can be seen as the left and right margins there are two holes: in these is made to pass and weld a thin copper wire that is intertwined between the two heads, later, the segment by the same PCB.
It 'very important to know that the LEDs are very sensitive and touchy, and you need only reverse the power to burn them instantly. In addition it must be ascertained with certainty that the chain DATA_IN >>> DATA_OUT functions properly because each LED receives from these pin the necessary information to turn on and with which color. A malfunction of this connection is sufficient to invalidate all the LEDs that follow the faulty. I've already been in the construction of maxi_orologio. Per avere la certezza della bontà del singolo led avevo prodotto un PCB come quello della foto soprastante (with 8 LEDs instead 5) but with a female connector on which to place the LEDs and test with a special sketch. With this system I found the LEDs with connection problems and power and then immediately discarded. (Indeed quarantined !!!).
THE NEXT STEP:
Defined then the general approach (each PCB will be placed in each of the star segment) and produced the first, I begin to study how to manage this chain of LEDs , such as lighting design and if you make them programmable or not.
In this regard some time before you think this project, On the subject of experimentation, I bought 3 moduli Bluetooth HC05 precisely for these systems also try. And so I thought: why not manage autonomously and independently the different lighting effects: simply because you do not use a tablet or smartphone ??. (Sooner or later we'll need even when we're c ....).
So after a series of experiments on the use of these modules, I decided that the various games will be programmable through these modules using them in terminal mode interactively. In internet (Play Store) if you do a search of APP that manage Bluetooth modules you will have an endless list valid for all tastes. I have selected and tested different all with special and specific characteristics for certain uses, I needed but only those who carried out the terminal emulation. Ovvero unInput/Outputseriale da e verso lo sketch con cui inviare singoli caratteri o stringhe. I have selected two: “Bluetooth Terminal” (more reliable), “Arduino Bluetooth Controller” (good). Both seek the device (activate Bluetooth on the tablet) and after the connection still waiting to receive messages or transmit strings or single characters. E non fanno altro.
so Great for what I need: or an interactive conversation between the sketch and the Bluetooth for controlling the various games of light.
The Bluetooth module is a HC05 which can be used as master or slave. But it is necessary to activate this function the first time is performed, which are connected and a password is required which can be "0000" The "1234”. When switched on a red LED starts to flash rapidly until it is made a connection with a peripheral device. A connection established the same LED flashes every 4/5 seconds about demonstrating the actual connection. Once activated you are usable and you can verify the address of each mac_address in shape so as to distinguish. They are also customizable entering mode AT through a serial connection. You can use an Arduino sketch with serial connection 38400 or, as I did, using a type serial converter FTDI32 which also it has the ability to handle signals at 3.3V. This lets you use the command mode AT to customize and test the module itself. It 'should be noted then that the standard serial connection to the I / O between the module and the serial ports of Arduino is carried out at 9600 baud. Also this value can always be changed in the mode AT. In the network as usual you can find a lot of more or less comprehensive documentation as well as enable mode AT. Dato che il modulo lavora 3,3V può essere necessario un convertitore da 5/3 bidirectional or a resistive divider on pin TX. In the figure an example.
DEFINITION OF 'HARDWARE
Done experiments and tests with the Bluetooth module to verify the behavior of both the module and discharged APP, I started designing the HW management using the following components:
Un micro ATMega328
A converter of signals between 5 and bidirectional 3v
A micro-module power supply 3V
2 Capacitors from 22pF
1 16MHZ Quartz
1 Electrolytic capacitor 1000uF / 25V
1 Female connector 4 pin (per FTDI32)
1 Female connector 6 pin (Bluetooth Module)
1 jack connector for general 5V supply
The micro ATMEGA328 which travels sketch. Not using the ARDUINO_1 development board requires a quartz and 16MHZ 2 two capacitors from 22pF. To upload the sketch as a result of the compilation I preferred to bring on an external connector the connection between the TX / RX pin of the micro and the pin RX / TX serial converter FTDI32 and use the DTR signal to reset the micro to bring it in upload mode. Una volta funzionante non è necessario che detto convertitore sia sempre presente in quanto serve soltanto per ricaricare lo sketch. In theory una_tantum. Another six external connector pin is used to connect the Bluetooth module. Again I preferred can be removed for reuse of the module.
Regarding the power I felt a sufficient battery charge for smartphones that provides 5V with 1A. From tests even with all the LEDs (Remember that the maximum absorption of each LED is when are lit with white color which does not happen in the context), even after a few hours, non si rilevano surriscaldamenti e questo tipo di carica batteria rimane “freddo”.
SCHEMES AND PCB
Non ho disegnato schemi in quanto sono partito da alcuni PCB disegnati per altri progetti e riadattati allo scopo. In the picture the base PCB that houses all components:
Let us see how is willing: In the bottom left of the two plots for housing the power jack. Above: the capacitor 1000uF, the 3 pitches for connection VCC/GND/DATA_IN (pin 4) of the LED chain, the 5 pitches for connection RX/TX between Arduino and the module FTDI32. At the bottom of the housing of the 3V power supply module to power both the Bluetooth module that the bi-directional converter module 5 / 3V for the signals TX/RX between the module and Arduino. Per inciso il modulo Bluetooth si connette ad Arduino ai pin3 e 2. (RX/TX). The six-pin connector at the top right to connect. Connections in red are "jumpers". “RS"It is a jumper that connect a button for"resetArduino ".
In the picture below the completed card and its "silkscreen".
If anyone is curious to know how I got this "silkscreen" here is the system: The application PCB_EXPRESS that now used for years also allows you to print in format 1:1 everything has been designed as components. So after printed and cut in its dimensions is subjected to lamination in order to obtain a sufficiently rigid support for both drilling that for bonding on the chip which takes place without glue but only with the pressure of the various components including plinth.
DEFINITION OF SOFTWARE
Usually before producing PCBs in a definitive manner beginning with a "soft" programming or with a minimal sketch with which to try the basic connections and the operation of the devices of goodness. I always have a Arduino_1 and Arduino_Nano with which to do tests with flying wires.
As I announced at the opening play of light must be different and programmable: a system that allows to interact via Bluetooth.
And ice WS2812 They are managed by the library Adrafuit_NeoPixel with which we can turn off each LED individually with different colors (nel range R-G-B) and increasing or decreasing brightness.
The Bluetooth module does not require any particular library, but it is connected in a serial manner with the functions "Software Serial” insite nelle librerie di Arduino. Queste hanno le stesse funzionalità di quelle standard seriali.
In the sketch is anyway foreseen the possibility to carry out a debug (on serial port via Hyper_Terminal) to verify the various processes.
For the first operations carried out in the classic "setup"It is as follows:
Library Initialization Adafruit_Neopixel. Setting a minimum and immediate shutdown brightness. This is necessary, otherwise the chain lights up with random colors and high brightness.
Library Initialization Software_Serial (9600 baud) to access the Bluetooth module
Request whether or not debugging: this can be done if within three seconds after the message output is answered by typing any character. The other way around (even with off serial monitor) the not active and not debug messages will be issued. This feature has been used to debug the sketch and also to individually test each of the LED chain. And 'in fact it expected, that the number of active LED (50 at the end) is only stated in debug mode if less than 50. A sketch concluded no longer needed.
It sends to a Bluetooth module "menucommand "to manage color games.
It makes the first lighting of the LED chain with red.
The method of ignition of the LEDs must be borne in mind that should remain on until a new command intervenes not equal to or different from the previous. Now, while the controls that light up all the different colored LEDs (all together and in a static way) remain lit, codes for those games which provide for different movements is necessary that at the end of the programmed movement, this game restart its cycle.
The sketch of the cycle, as is normal, It is performed by the procedure "loop"And it is extremely synthetic: are only four "if”. Perché il ciclo viene avviato aspettando che dal modulo Bluetooth venga inviato uno dei codici programmati e visibili dal menù. So an infinite loop and in the meantime the star will be on the color "red" (command performed in the setup).
In this photo we can see the menu on the tablet screen sent:
When APP connects and recognizes the form is issued mac_address the module. The module can be activated at any time also activated sketches and Stella turned on. Simply ask for the postponement of the start menu for controlling the functions provided. This is also possible by resetting the system with the button "reset”.
At the state of the art the functions provided for the various plays of light are the following:
Turning of the whole chain of LEDs in the colors programmed:
The chain remains lit on the chosen color. The color chosen is then available to other games if not expressly stated.
Turns all colors sequentially programmed.
Turns in sequence all the chain LEDs for all colors programmed.
Turns sequence in a chain at a time by turning off the previous one.
As for the game "T" but every chain stays on.
Turns in sequence the individual LEDs of each chain by blowing them out successively in sequence.
Blink entire chain for a period equal to 5.
Fading: It illuminates the entire chain by increasing the brightness in ascending order and then make a descending cycle of brightness.
Reset of delay values and brightness (Lumen= 5, Delay= 100ms).
increases (D) or decreases (d) the delay values 50 ms.
increases (L) or decreases (l) the values of the brightness of 5 values.
the function menu referral request.
Game Programming: dopo l’invio di questo codice viene richiesta una stringa massima di 18 characters enclosed by '#’. Ogni carattere digitato rappresenta il codice del gioco che deve essere eseguito. So it becomes possible to enter a series of codes several games that will be executed sequentially until you do not need a new code. At the state of the codes "L/l” e “D/d"They should not be included because not considered. E’ comunque possibile inviare questi codici in qualunque momento: They will be taken into consideration at the end of the programmed cycle. Cycle then starts from the beginning like all the other games individually.
Each game stays running until it is not sent from Bluetooth a new game code. So it is possible that the implementation of the new game starts when the previous play cycle ends. But you will have to wait until the end of the previous game.
A special feature on "P”: this feature allows you to program a sequence of play of light: so once programmed these games will be recycled until when will not be receiving a new command. Example: “1B2F3M #"Cycle will be: Blink red(1), Fading green(2), M = Single LED blue(3).
The commands "D/d” aumentano diminuiscono di 50ms i ritardi di esecuzione delle singole funzioni e quindi l’accensione periodica dei singoli led o segmento. The same applies to the commands "L/l"That increase or decrease the brightness of the LEDs. These commands can not be entered into the function of the command string "P”. Each code "D/d"Increases or decreases by 50 ms delay. Ogni codice “L/l” aumenta o diminuisce la luminosità di un valore pari a 50. The new values are also sent to the Bluetooth module.
After receiving a single command (that will always be an ASCII character) and discriminated against the code "P"It is launched the function"Analysis”: this takes place in the recognition of the command and its execution with a subsequent function "Exec_Giochi"That starts the individual routines of games. Always keeping in mind the recursion of the same games in the sense that if they are not received by the Bluetooth module these different commands are repeated.
In routine Exec_Giochi the command "P"Carries a"recursion"Calling it in the same routine for every game code extracted from the input of the games table and launches the execution of the command by calling, just, the same routine Exec_Giochi. This cycle course ends when you run out of commands inserted to re-enter the main loop.
STATE OF’ ART:
At the present state, the sketch can be complete (until I will study other light effects) at least with regard to scheduled games. It comprises over 700 But lines whereas about one hundred initial lines are just comments without even count those inserted between the lines of code. So in my opinion be read by all.
The next step will be: the construction of a container to collect the circuit, a protection system of the entire structure of the star in anticipation of outside exposure to prevent (since it will be used in the winter months as outdoor decor) weather. A small video to show some of the games: most have failed to do.
The Bluetooth module when activated and in line with APP (any of those used) no problem except when getting by APP, is deactivated by logging off or closing the’ APP. This results in sending a string like “+DISC:SUCCESS OK” long 17 characters. In hexadecimal: “2B 44 49 53 43 3A 53 55 43 43 45 53 53 GIVES4F 4B GIVES”. In due caratteri in rilievo “GIVES” They are interpreted as if they were from Hper_Terminal CR/LF (carriage_return, line_feed) while on the other hand they are values that do not have a match in ASCII. This string causes the loss of the game code currently active thwarting any planned sequence and active. I intend to find solutions to prevent this.
I conclude by thanking the Elettroamici who have had the patience to read and if I wrote something wrong correct me. Sempre a disposizione per approfondimenti e aggiustamenti.