View previous topic :: View next topic |
Author |
Message |
plouf
Joined: 19 Jan 2012 Posts: 78 Location: Athens,Greece
|
Posted: Sat Aug 28, 2021 3:27 pm Post subject: Super Simplfied WIFI example/working code (WizFi360) |
|
|
From time to time there are questions about how to use wifi.
Recently i found WizFi360, from Wiznet. https://www.wiznet.io/product-item/wizfi360/
it is very similar to ESP8266 in shape - firmware - cost
as said "searching too long to find something to fit our need simple and cheap"
I have come across to use the ESP8266 many times, but the overloaded information lack (until recently) to proper english documentation from manufacturer etc, i had confused.
In contrary wiznet products are easy to get in europe/usa , as it is available in most big European warehouses
at the time of writing WizFi360 cost 2,99€ .. And have good english documentation
In the Simplest form i will present you, we will use device's own SoftAP/webserver to configure SSID,
which makes compatible with any mobile OS and any laptop out there.
Additionally removes "code space" and complex from our mcu code.
The following program is supersimplified, among other it does not check for anything, but i have a working WIFI program in 542 bytes in one of the older AVR (90S2313) out there, and have room for more code !
How Sample Program Works
1) The program set's WizFi360 in SoftAP mode and initiates WebServer, if during power up you have press PB.0 to GND
2) After this step you connect to Device SoftAP using mobile phone/laptop and open a browser http://192.168.36.1
you will see a image as bellow to set SSID / password and press save
3) Start a Server listening to Port 5000 in a server at 192.168.1.10 (as this is in example program)
4) power device again
5) sending 1 to 3 will toggle PD4/5/6, sending 4 will return PORTB status in ascii
so this example program is actually 8 button status check, and 3 led control from other side of lan
Wiring
only connect 3.3 volt to avr + wifi and uart1 of WizFi360 to AVR uart
Sample Program Code
Code: | 'Simplest Possible WizFi360 Example
' 542 bytes !!
$regfile = "attiny2313.dat"
$crystal = 3686400
$hwstack = 40
$swstack = 16
$framesize = 32
$baud = 115200
DDRB = &B00000000 ' PortB = input
PORTB = &B11111111 ' Pull UPs
DDRD = &B11110000 ' PD4-7 = output
dim i as byte
dim temp as byte
Waitms 2000
if PINB.0=0 then ' button 0 is pressed during startup so entering configuration mode
print "AT+RESTORE=1"
waitms 1000
print "AT+CWMODE_CUR=2"
waitms 1000
print "AT+WIZ_NETCONFIG"
do
loop ' halt executing program to prevent mess with configuration
endif
' START A SOCKET CONNECTION
print "AT+CIPSTART={034}TCP{034},{034}192.168.1.10{034},5000" ' AT+CIPSTART="TCP","192.168.1.10",5000
Waitms 1000
print "AT+CIPMODE=1" ' change to singe connection mode
waitms 1000
print "AT+CIPSEND"
waitms 1000
print ' immediatly send "return" means enter transparent mode
' Start a Program just like use a "true serial"
' "program" is send ascii 1 = togle pin PD4 2 = toggle PD5, 3 = Toglle PD6, 4 = return Portb status in ASCII
do
i = waitkey()
Select case i
case 49 : toggle PORTD.4
case 50 : toggle PORTD.5
case 51 : toggle portD.6
case 52 : print bin(PINB)
end select
loop |
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sat Aug 28, 2021 3:48 pm Post subject: |
|
|
hi plouf
thanks for sharing this. yes wiznet has proven to be a reliable source with good documentation. this seems a great module for a good price. i will order one to test it. wanted to do that before but your post is a good reminder.
the AT set seems common so can be re-used. _________________ Mark |
|
Back to top |
|
|
AlanGHosler
Joined: 25 Jan 2011 Posts: 109
|
Posted: Sun Feb 13, 2022 12:57 am Post subject: More WizFi386 |
|
|
Thank you for posting your bare-bones example. Have you done more with the WizFi360?
I am interested in how to post text to an email service such as smp2go.com.
Elsewhere in this usergroup I have posted my program for sending data as SMS and photos as MMS email messages. AT&T and others are sunsetting their 3G service. Rather than convert my work to 4G I have decided to switch to a Nighthawk LTE Modem Hotspot Router (MR1100) and send the data out via WiFi.
I do okay on electronic design and coding but I am weak on the network considerations. |
|
Back to top |
|
|
plouf
Joined: 19 Jan 2012 Posts: 78 Location: Athens,Greece
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|