In this project I have reused an ELEKTOR APP. Elektor December 2016
The original design used an atmel328p and an ESP-01 module as hardware.
I used an ESP-01 module in combination with a PIC 16f1827and with the AT commands
I adjusted the outputs of the RGB PWM and the OUT pins as in the project that I present.
The difference lies in the ESP module and in the use of a much more interesting software.
I used a Wemos D1 Mini a 74hc595, uln2803 driver and a mosfet for RGB outputs;
you can also delete the 74hc595 and use all the bits directly on the module esp.
Other port expansion circuits can also be used, in I2C (Ex: PCF8574) or in SPI (Ex: CD4094) and more.
So I simplified the hardware of the first project.
basic esp code:
'******************************************************************************
' Programma di controlo RGB e 8 OUT con APP WIFI CONTROL
' estratto della rivista Elektor Dicembre 2016
' che utilizzava ATMEL328P e MODULO ESP-01
'
' Programma per moduli ESP12-E ESP12-F
' link App di Elektor
' https://play.google.com/store/apps/details?id=com.elektor.wificontrol
' link esp basic
' https://sites.google.com/site/annexwifi/home
' link esp basic help
' https://cicciocb.com/annexhelp/V1.42//?topic=
'
' Date : 3/05/2020
' Autori gianmagna & son
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D0=16:D1=5:D2=4:D3=0:D4=2:D5=14:D6=12:D7=13:D8=15:D9=3:D10=1
x = 0
Dim abc$(80)
pin.mode 16,Output 'CS per SPI
spi.setup 100000
onUrlMessage urlAjax
Wait
urlAjax:
wlog "message received " + UrlMsgGet$()
'message received example
':80/?m1=&P1=1&P2=1&P3=1&P4=1&P5=1&P6=1&P7=1&P8=1&s=&Rv=84&Gv=173&Bv=86 (all OUT 1 + rgb)
'message received
':80/?m1=&s=&Rv=84&Gv=173&Bv=86 (all OUT 0 + RGB)
abc$ = UrlMsgGet$() 'lettura messaggio
'catturo il valore se 0 o 1
P1 = val(UrlMsgGet$("P1"))
P2 = val(UrlMsgGet$("P2"))
P3 = val(UrlMsgGet$("P3"))
P4 = val(UrlMsgGet$("P4"))
P5 = val(UrlMsgGet$("P5"))
P6 = val(UrlMsgGet$("P6"))
P7 = val(UrlMsgGet$("P7"))
P8 = val(UrlMsgGet$("P8"))
'catturo il valore di R G B
r = val(UrlMsgGet$("Rv"))
v = val(UrlMsgGet$("Gv"))
b = val(UrlMsgGet$("Bv"))
wlog p1, p2 ,p3, p4, p5, p6, p7, p8 ' visualizzo i pin
wlog r, v, b ' visualizzo R G B
'sul Modulo 12-F e' possibile usare questi pin direttamente sulle uscite
X = 0
'P1 TO P8 representano lo stato di ogni pin
If P1 = 1 Then X = X Or 1
If P2 = 1 Then X = X Or 2
If P3 = 1 Then X = X Or 4
If P4 = 1 Then X = X Or 8
If P5 = 1 Then X = X Or 16
If P6 = 1 Then X = X Or 32
If P7 = 1 Then X = X Or 64
If P8 = 1 Then X = X Or 128
wlog X ' valore del byte con i pin attivi
' qui e' possibile usare SPI con 74hc595 e I2C PCF8574
pin(16) = 0 ' CS LOW pin 14 del 74hc595
X = spi.Byte(X)
pin(16) = 1 ' CS High carico il latch del 74hc595
pin(16) = 0 ' CS Low 74hc595
'pwm values are 0 to 1023, but R,G,B values are only 0 to 255, so need multiplying by 4 to match
PWM(12) = r * 4
PWM(15) = v * 4
PWM(2) = b * 4
URLMSGRETURN "ok"
Return
End
'************************************************************************
The application can be downloaded from this link:
https://play.google.com/store/apps/details?id=Com.elektor.wificontrolOnce installed, the APP only requires the IP address of the receiver and automatically puts the door: 80
In our case we have to add the IP address + "/ msg?" And that's it!
For example: (192.168.1.35/msg?)
Then select the bits you want to turn on and the color sliders
Press SEND
photo
https://ibb.co/bd7Xr2mhttps://ibb.co/JxqyQbthttps://ibb.co/VCg3rgKhttps://ibb.co/kSzYjXBavailable for explanations
Gianmagna