WizFi250 GPIO & ADC with Smartphone

details

In this posting, we are introducing an example code to control the LED & read the value of variable resistor of WizFi250-EVB. Without additional MCU board, a smart phone App directly connects to WizFi250-EVB and controls GPIOs.

wizfi250-GPIO-1

 

From the WizFi250 firmware version 1.0.3.1, the commands for GPIO and ADC has been supported. You can download the latest version from below link.

http://wizwiki.net/wiki/doku.php?id=products:wizfi250:wizfi250firmware:start

GPIO

You can control GPIO1 in the WizFi250-EVB with below commands.

AT+FGPIO=1,1,0
[OK]
AT+FGPIO=1,1,1
[OK]
 
First Option : Input or Output
Second Option : GPIO number
Thirst Option : High or Low

 

ADC

Below commands will let you read the ADC of WizFi250. WizFi250 supports 12bit ADC that is controlled by GPIO 5 in Wizfi250-EVB. You can see the ADC value changes from 0 to 4095.

AT+FGETADC=?
0
AT+FGETADC=?
1344
AT+FGETADC=?
3548
AT+FGETADC=?
4095

 

Testing GPIO of WizFi250-EVB

Let’s control the GPIOs of WizFi250-EVB. For the testing, we will connect the LED & variable resistor to WizFi250-EVB as below figure.

wizfi250-GPIO-2

 

We need to change the WizFi250 operation mode to air command mode. You can use below two methods. Both of them are examples about Air Command mode with TCP 50001

<Air Command mode using AT commands>

When WizFi250 operates as station mode and associates with an AP, you can change it to Air command mode using AT commands (for more detail, refer to http://wiznetmuseum.com/portfolio-items/wizfi250-air-command-mode/?portfolioID=12060

AT+WSET=0,wizohp
[OK]
AT+WSEC=0,,wiznet218
[OK]
AT+WNET=1
[OK]
AT+WJOIN
Joining : wizohp
Successfully joined : wizohp
 
[Link-Up Event]
  IP Addr    : 192.168.13.29
  Gateway    : 192.168.13.1
[OK]
AT+MAIRCMD=O,T,50001,1
[OK]

 

Air Command mode using a function button in WizFi250-EVB (When WizFi250 operates as AP mode)

Set AP Mode & Web Server Launch
[OK]
 
[Link-Down Event]
WizFi250 Version 1.0.3.1 (WIZnet Co.Ltd)
 
[Link-Up Event]
  IP Addr    : 192.168.12.1
  Gateway    : 192.168.12.1

 

Now, a smart phone app will connects to WizFi250 using air commands.

Execute the WizFi250 smart phone app and select the configuration menu. Input IP address and port number of WizFi250 and press the “Connect”

If you touch the LED button in the app, you can see the LED on/off. ADC button gets & displays the ADC value of WizFi250. Status button will show the WizFi250 status information.

wizfi250-GPIO-3

public void onClick(View view) {
 
    if (view.getId() == R.id.buttonLed1)
    {
        addText("Toggle LED\n", Color.RED, Color.TRANSPARENT);
        if ( toggle_led1 )  { sendDataToSack("WizFi250AirCmd:AT+FGPIO=1,1,1\r"); toggle_led1=!toggle_led1; }
        else                { sendDataToSack("WizFi250AirCmd:AT+FGPIO=1,1,0\r"); toggle_led1=!toggle_led1; }
    }
    else if (view.getId() == R.id.buttonLed2)
    {
        addText("Get ADC\n", Color.RED, Color.TRANSPARENT);
        sendDataToSack("WizFi250AirCmd:AT+FGETADC=?\r");
    }        
    else if (view.getId() == R.id.buttonLed3)
    {
        addText("WiFi Status\n", Color.RED, Color.TRANSPARENT);
        sendDataToSack("WizFi250AirCmd:AT+MINFO\rAT+MMAC=?\rAT+WSTAT\rAT+WNET=?\rAT+WSEC=?\r");
    }
}

 

You can download the smart phone App source code from below link.

WizFi250 Smart-Phone App Code Download

 

1
COMMENTS

Please Login to comment
1 Comment authors
Calgary Painting contractor Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Calgary Painting contractor
Guest

Greate post. Keep posting such kind of information on your blog.

Im really impressed by your blog.
Hi there, You’ve performed an incredible job. I’ll definitely digg it and for my part
suggest to my friends. I’m sure they will be benefited
from this website.