Nuovo Tipico (T16) Strip LED Singola

66 views
Skip to first unread message

Flavio

unread,
Aug 26, 2013, 3:56:45 PM8/26/13
to sou...@googlegroups.com
Ho scritto, lato arduino questo nuovo sketch per la gestione di una strip led singola.
è in funzione da 48h, sembra fare il suo dovere correttamente,nonostante il tipico non sia prorpio adatto.
Naturalmente dovrà essere assegnato un nuovo tipico, io non ho grossa esperienza lato android....

I pin sono :
pin 9 --> uscita pwm
pin 8 --> accensione alimentatore e abilitazione ponte H
pin 2 --> pulsante fisico



/**************************************************************************
Souliss - RGB LED Strip
Control and RGB LED or a Strip using the PWM, fade in/out and flash 
effects are available as the Android interface.
 
It require an Ethernet board based on Wiznet W5100 or Microchip ENC28J60,
but can be used with different board types.
 
CONFIGURATION IS MANDATORY BEFORE COMPILING
Before compiling this code, is mandatory the configuration of the framework
this ensure the use of proper drivers based functionalities and requested
communication interface.
Configuration files are located on /conf folder, is suggested to use this 
code on one of the boards listed below, the code can also compile on other
boards but may require modification on I/O definitions.
Run this code on one of the following boards:
Board Conf Code Board Model
        0x03         Arduino Ethernet (W5100) 
0x04 Arduino with Ethernet Shield (W5100)
0x05 Arduino with ENC28J60 Ethernet Shield
******************** Configuration Parameters *********************
Configuration file Parameter
QuickCfg.h #define QC_ENABLE 0x01
QuickCfg.h #define QC_BOARDTYPE 0x03, 0x04, 0x05

Is required an additional IP configuration using the following parameters
QuickCfg.h const uint8_t DEFAULT_BASEIPADDRESS[] = {...}
QuickCfg.h const uint8_t DEFAULT_SUBMASK[]       = {...}
QuickCfg.h const uint8_t DEFAULT_GATEWAY[]       = {...}
***************************************************************************/
#include "Souliss.h"
#include "Typicals.h"
#include <SPI.h>

// network addresses
#define network_address_1 0x0011 // 0x0011 is equal to 17 in decimal
#define network_my_subnet 0xFF00
#define network_my_supern 0x0000

#define LEDCONTROL 0 // This is the memory slot for the logic that handle the light
#define LEDBRIGHTNESS 1 // This is the memory slot for the logic that fade the light

// define the shared memory map
U8 memory_map[MaCaco_MEMMAP];

// flag 
U8 data_changed = 0;

// Note, this example use a faster time base to allow a smooth effect
// while playing with the color picker for the fadeing light. Is not raccomended
// to use a so faster time base for other cases.
#define time_base_fast 3 // Time cycle in milliseconds
#define time_base_slow 10000         // Time cycle in milliseconds
#define num_phases 255 // Number of phases

U8 phase_speedy=0, phase_fast=0, phase_slow=0;
unsigned long tmr_fast=0, tmr_slow=0;  

void setup()
{
// Setup the network configuration
//
// The vNet address is 11(hex) that is 17(dec), so the IP address is
// the DEFAULT_BASEIPADDRESS[] defined in ethUsrCfg.h plus 17 on last 
//  octect. If DEFAULT_BASEIPADDRESS[] = {192, 168, 1, 0} the IP address
//  for the board will be 192.168.1.17
Souliss_SetAddress(network_address_1, network_my_subnet, network_my_supern);

// Load the address also in the memory_map
Souliss_SetLocalAddress(memory_map, network_address_1);
// Set the typical logic to use, T11 is a ON/OFF Digital Output with Timer Option
Souliss_SetT16(memory_map, LEDCONTROL);
// Define inputs, outputs pins
pinMode(2, INPUT); // Hardware pulldown required
pinMode(9, OUTPUT); // LED STRIP PWM
pinMode(8, OUTPUT); // Power the LED -Power the Power Supply
}

void loop()
// The Souliss methods are scheduled in phases, this allow load
// balance and proper timing.

if(abs(millis()-tmr_fast) > time_base_fast)
{
tmr_fast = millis();
phase_fast = (phase_fast + 1) % num_phases;

// Execute the code every 1 time_base_fast
if (!(phase_fast % 1))
{
// Use Pin2 as ON command, Pin2 as OFF command
Souliss_DigIn(2, Souliss_T1n_ToogleCmd, memory_map, LEDCONTROL);
// Execute the logic that handle the LED
Souliss_Logic_T16(memory_map, LEDCONTROL, &data_changed);

// Use the output values to control the PWM
analogWrite(9, Souliss_Output(memory_map, LEDBRIGHTNESS));
         
                        // Use Pin8 as output to power the LED
Souliss_DigOut(8, Souliss_T1n_Coil, memory_map, LEDCONTROL);

// Retreive data from the communication channel
Souliss_CommunicationData(memory_map, &data_changed);
}
}
else if(abs(millis()-tmr_slow) > time_base_slow)
{
tmr_slow = millis();
phase_slow = (phase_slow + 1) % num_phases;

// Execute the code every time_base_slow
if (!(phase_slow % 1))
{                 
// The timer handle timed-on states
Souliss_T16_Timer(memory_map, LEDCONTROL);
}  
}




Flavio


Flavio P.

unread,
Aug 26, 2013, 3:58:23 PM8/26/13
to sou...@googlegroups.com
Testato su arduino leonardo + W5100, se a qualcuno interessa posso fare lo schemino, compreso di ponte H.

Flavio


2013/8/26 Flavio <master.fla...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
P ********* Consideriamo l'ambiente prima di stampare questa e-mail *** Think about environment before printing *********
Il contenuto di questo messaggio e-mail è privato e riservato al solo destinatario. L'utilizzo non autorizzato può costituire reato. Se ricevuto erroneamente siete pregati di cancellarlo e comunicarci via e-mail l'errata ricezione.

Di Maio, Dario

unread,
Aug 26, 2013, 4:12:55 PM8/26/13
to sou...@googlegroups.com
Si certo :) così lo inseriamo nel wiki.

Ho inserito negli issue la necessità di un tipico monocanale, appena possibile lo inseriamo.

Dario.

Flavio P.

unread,
Aug 26, 2013, 4:16:26 PM8/26/13
to sou...@googlegroups.com

Ci ho provato un po a lavorare modificando il 16, ma é necessario mettere mano all'app....:(

From Mobile Nexus

--

Di Maio, Dario

unread,
Aug 26, 2013, 4:20:01 PM8/26/13
to sou...@googlegroups.com
Si, il tipico viene mappato in Android con un codice, quindi le funzionalità sono hardcoded e va modificata e ricompilata l'applicazione.

Dario.

Flavio P.

unread,
Aug 26, 2013, 4:20:56 PM8/26/13
to sou...@googlegroups.com

Ma é disponibile il sorgente dell'app?

From Mobile Nexus

Il giorno 26/ago/2013 22:20, "Di Maio, Dario" <dario....@souliss.net> ha scritto:
Si, il tipico viene mappato in Android con un codice, quindi le funzionalità sono hardcoded e va modificata e ricompilata l'applicazione.

Dario.

--

Di Maio, Dario

unread,
Aug 26, 2013, 4:27:20 PM8/26/13
to sou...@googlegroups.com

Flavio P.

unread,
Aug 27, 2013, 6:21:36 AM8/27/13
to sou...@googlegroups.com
Allego schema della strip led singola.


2013/8/26 Di Maio, Dario <dario....@souliss.net>

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
LED_STRIP_SINGLE.png

Di Maio, Dario

unread,
Aug 27, 2013, 9:11:28 AM8/27/13
to sou...@googlegroups.com
Non ho capito quale funzione svolge quella bobina (credo di un relé).

Dario.


2013/8/27 Flavio P. <master.fla...@gmail.com>

Flavio P.

unread,
Aug 27, 2013, 9:57:13 AM8/27/13
to sou...@googlegroups.com
Si è un relè, K1 si chiama sullo schema, più in alto trovi il contatto di K1....
Toglie la 220 all'alimentatore 12v 20A, perchè a me non va di lasciare alimentata la "potenza" giorno e notte.
= tolgo il più possibile i consumi inutili :-)

Flavio

Di Maio, Dario

unread,
Aug 27, 2013, 10:01:41 AM8/27/13
to sou...@googlegroups.com
E' cosa buona e giusta :)

Dario.
Reply all
Reply to author
Forward
0 new messages