GithubHelp home page GithubHelp logo

wifirm04's Introduction

WiFiRM04 Library

WiFiRM04 library is an Arduino WiFi library for Hi-Link HLK-RM04 module. (http://www.hlktech.com/en/productshow.asp?id=142) This library is compatible with Arduino WiFi library and all examples of Arduino WiFi library could be compiled with this library with just a little modification.

Currently, this library doesn't support UDP feature and assign a static IP in client mode.

All features are tesed with firmware V1.78 and I have no idea if they could work with older firmware.

How to Install

  1. Download the WiFiRM04 library source.
  2. In the Arduino IDE, go to the Sketch -> Import Library... -> Add Library...
  3. Find the directory that contains the WiFiRM04 library source, and open it
  4. Check if you could see "WiFiRM04" under Sketch -> Import Library...

How to Use

Since this library is compatible with Arduino WiFi library, you could check Arduino web site to learn how to use it. (http://arduino.cc/en/Reference/WiFi)

Configuration

First and most important, MUST modify Arduino's serial driver to increase Rx buffer size or add hardware flow control support, because HLK-RM04 will try to output all data at once. If Rx buffer of your serial port is too small(or no hardware flow control support), you will lose those data.

By default, this library will use two UARTs to communicate with HLK-RM04 module. (firmware V1.78 can support two UARTs) If you don't want to use second UART of HLK-RM04, just modify utility/wl_definitions.h and change the definition of MAX_SOCK_NUM to 1. (but the second serial port will still be initialized in utilit/at_drv.cpp)

The serial ports I used are Serial1 and Serial2, you could change them by modifying utilit/at_drv.cpp and change the definition of AT_DRV_SERIAL and AT_DRV_SERIAL1.

Strongly suggest to use ES/RST pin to enter the AT command mode, but if you still want to change mode by sending specific serial data over serial port, just modify utilit/at_drv.cpp and mark #define USE_ESCAPE_PIN.

Others like baud rate and the GPIO used to pull ES/RST pin could be found in the from of utilit/at_drv.cpp. You could understand their usage by checking the source and comments.

Other Resources

User manual of HLK-RM04 module. (http://www.hlktech.net/inc/lib/download/download.php?DId=19)

This user manual doesn't contain the AT commands of lateset official firmware. (V1.78) You could find more useful information from the OpenWrt forum. (https://forum.openwrt.org/viewtopic.php?id=42142)

wifirm04's People

Contributors

chunlinhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wifirm04's Issues

Arduino Uno R3 Can't switch RM04 to AT mode

I want send data to server over http by wifi, and I use the device is http://www.hlktech.com/en/productshow.asp?id=147.

I modified the AT_DRV_SERIAL and AT_DRV_SERIAL1 to Serial in the utilit/at_drv.cpp.
Config the ssid and password.
Run the WifiWebClient sample in library.Through the Serial Monitor , , displays the following information.

CLport=%s

=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1480onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1AtDrv::isWiFiConnected

=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1120onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1

=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1120onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1

=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1120onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1

=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1120onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1

=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1120onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1

=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1120onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1
=?ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1486onfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1fig ra0 | grep 'inet addr:' | sed -e 's/inet addr:\(.*\).*Bcast:.*Mask:.*/\1/' > /dev/ttyS1Can't switch to at mode
%s
o=%s
ips_2_2.4ghz

"ips_2_2.4ghz" is the ssid of my wifi.

This is what reason is caused?

Q:How to modify arduino's serial driver?

Hi chunlinhan,
Thanks so much for the wifi lib, and I'm now tring to use it in my RM04.
I saw the most important tip: "MUST modify Arduino's serial driver to increase Rx buffer size or add hardware flow control support."
Sorry that I'm a newbie, could you please give some more introduction about how to modify the buffer size? and if not modified, can some simple program run? for example, send a get request to some http address.
BTW, I found a wifi module which may save time for connecting hardwares: http://item.taobao.com/item.htm?id=18633529918
http://item.taobao.com/item.htm?id=25481148978
Hope it helps to some guys.

Parsing server response

Hello!
In browser it gives me this string: "{"result":true}"
in serial monitor: ""{"resul\r"" and thats all, how do i parse it correctly? however it shows in serial monitor that Content-Length: 19

Pls, note that I am using only Serial1 and changed max sock numbers to 1

WiFiRM04 with 32u4 (Leonardo or Pro Micro)

Dear Chunlinhan,

Firstly, let me say that you have done excellent work producing this library!

Do you think it would be possible to implement the library on an arduino without two hardware UARTS like the Leonardo or Pro Micro?

Maybe using softwareserial for serial2?

(Serial on the 32u4 is USB only and Serial1 is hardware uart)

Regards,

Simon

My RM04 have the trouble

Sorry..i back...

I have the new trouble
when i use the WifiUdpNdpClient library
status:
[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::494]-I-Not Connected
[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::489]-I-at+wifi_ConState=?

[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::494]-I-Not Connected
[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::489]-I-at+wifi_ConState=?

[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::494]-I-Not Connected

it again and again appear...
what happean...

other library can connect the ap
but this library can't....

help me plz.. and sorry my english not well

Can't switch to at mode

Hi,

I have an Arduino Mega 2560 and HLK-RM04 and try to test the WiFiWebClient example. When I run the sample, the serial monitor always display following information. I make sure the baud rate in at_drv.cpp is the same with the value of the serial configure in configuration page. Can you please help me to fix the issue?

The output in serial monitor:
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::936]-I-Can't switch to at mode
Attempting to connect to SSID: MyWifi

The HLK-RM04 with extension board I use:
http://www.aliexpress.com/store/product/Cduino-Uart-To-Wifi-Module-Hlk-Rm04-Rm04-Shield-Etension-Board-Atmega-328P-Uno-R3-Serial/633808_1655815819.html

Thanks.

Regards,
Kent

Compiling for Arduino Uno

I'm trying to compile the library for an Arduino Uno, since I have this module as a shield version ( http://ledsee.com/index.php/arduino-modules2013-02-16-10-32-17/arduino-shields/wifi-arduino-schield-detail )

The Uno has only 1 serial port, so I changed

#define AT_DRV_SERIAL Serial

inside at_drv.cpp, and set

#define MAX_SOCK_NUM to 1

inside "wl_definitions.cpp" to avoid Serial1 and Serial2 not defined error

But now I get new errors:

Arduino: 1.0.5 (Windows NT (unknown)), Board: "Arduino Uno"
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Program Files (x86)\Arduino\libraries\SoftwareSerial -IC:\Program Files (x86)\Arduino\libraries\WiFiRM04 C:\Users\KlaasDC\AppData\Local\Temp\build374150616553823502.tmp\ScanNetworks.cpp -o C:\Users\KlaasDC\AppData\Local\Temp\build374150616553823502.tmp\ScanNetworks.cpp.o 

  Using previously compiled: C:\Users\KlaasDC\AppData\Local\Temp\build374150616553823502.tmp\SoftwareSerial\SoftwareSerial.cpp.o

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Program Files (x86)\Arduino\libraries\SoftwareSerial -IC:\Program Files (x86)\Arduino\libraries\WiFiRM04 -IC:\Program Files (x86)\Arduino\libraries\WiFiRM04\utility C:\Program Files (x86)\Arduino\libraries\WiFiRM04\WiFiRM04.cpp -o C:\Users\KlaasDC\AppData\Local\Temp\build374150616553823502.tmp\WiFiRM04\WiFiRM04.cpp.o 

C:\Program Files (x86)\Arduino\libraries\WiFiRM04\WiFiRM04.cpp:11: error: too many initializers for 'int16_t [1]'
C:\Program Files (x86)\Arduino\libraries\WiFiRM04\WiFiRM04.cpp:12: error: too many initializers for 'uint16_t [1]'

Is the code only meant for Arduino Mega?
Thanks

Need help to connect with web

Hi
I am using RM04 on my home automation system, its work fine in local network.

I want to get data from web. How it can be done?
I am using 8051 microcontroller.

Just a hint is enough for me, i have attached the configuration screen shot of my wifi module.

Do i need to do this by using the AT Commands. if its through at commands what are the commands used to get the webpage of www.google.com

i tried to go through your code, but i cant since i am new to arduino. I am using Bascom BASIC for my 8051 and avr microcontroller.

Any help from your side is really appreciated.

Thanks
Binu

Conflicting Declarations WiFiRM04 & Arduino1.6.4

Getting conflicts when I try and include WiFiRM04 library using Arduino 1.6.4:

Error compiling.
In file included from c:\users\xxxx\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdio.h:47:0,
                 from C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\utility/debug.h:13,
                 from C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:6:
c:\users\xxxx\appdata\roaming\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\sys\types.h:97:24: error: conflicting declaration 'typedef short unsigned int u_short'
 typedef unsigned short u_short;
                        ^
In file included from C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:4:0:
C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\utility/socket.h:71:18: error: 'u_short' has a previous declaration as 'typedef uint16 u_short'
 typedef uint16   u_short; /**< 16-bit value */
                  ^
C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp: In member function 'virtual int WiFiRM04Client::read(uint8_t*, size_t)':
C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:127:47: error: no matching function for call to 'ServerDrv::getDataBuf(uint8_t&, uint8_t*&, size_t*)'
   if (!ServerDrv::getDataBuf(_sock, buf, &size))
                                               ^
C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:127:47: note: candidate is:
In file included from C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:12:0:
C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\utility/server_drv.h:28:17: note: static bool ServerDrv::getDataBuf(uint8_t, uint8_t*, uint16_t*)
     static bool getDataBuf(uint8_t sock, uint8_t *data, uint16_t *len);
                 ^
C:\Users\xxxx\Documents\Arduino\libraries\WiFiRM04-master\utility/server_drv.h:28:17: note:   no known conversion for argument 3 from 'size_t* {aka unsigned int*}' to 'uint16_t* {aka short unsigned int*}'
Error compiling.

Will try going back to Arduino 1.6.3

how to use Arduino to connect with RM04 while RM04 is already configured with configure page

Hi

Here is the RM04 I am using, it is not attached to the extension board.
image

I already configured my RM04 with the configure page as below
image

So now when I power up the RM04 module, I can ping it successfully
image

My problem is that how can I use Arduino to access a http page with the module since the module is already configured and up running.

I was trying to use the WiFiWebClient example, but it does not work. Or is there some part of the code in WiFiWebClient I should erase??

This is the output shown on the serial monitor...
image

Fail to set net mode

hi, I hooked up RM04 with my mega2560, tried the first example ConnectNoEncryption, and got the following output:

[/Users/tf/Documents/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::488]-I-at+wifi_ConState=?
[/Users/tf/Documents/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::493]-I-Not Connected
Attempting to connect to open SSID: TFKJ-WiFi
[/Users/tf/Documents/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::539]-I-at+netmode=2
[/Users/tf/Documents/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::545]-I-Fail to set net mode

I tried other examples and it seems that all the at command cannot be executed.

Any suggestions?

And thanks for the great lib.

WiFiWebServer

I have problem when i try to creating web server with my mega
i used your example program "WiFiWebServer", and i edit these line

"char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password"

into

"char ssid[] = "Satrio"; // your network SSID (name)
char pass[] = "asdasdasd"; // your network password"

Satrio is my tethering WiFi name with my handphone

but when i try to communicating with Serial in my mega, this message appear:

Attempting to connect to SSID: Satrio
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::539]-I-at+netmode=2
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::517]-I-at+wifi_conf=Satrio,auto,asdasdasd
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::556]-I-at+net_commit=1
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::488]-I-at+wifi_ConState=?
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::1018]-I-at+mode=?
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::1110]-I-at+remotepro=?
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::316]-I-at+remoteport=?
Remote port: 8080
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::1358]-I-curPort != port
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::1226]-I-at+remoteport=80
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::771]-I-at+timeout=?
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::568]-I-at+reconn=1
SSID: [C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::1984]-I-at+excxxx=iwconfig ra0 | grep ESSID | sed -e 's/.ESSID:"(.)".Nickname:"."/\1/' > dev/ttyS1
Satrio
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::358]-I-at+excxxx=ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:(._)._Bcast:.Mask:./\1/' > /dev/ttyS1
Local IP: 192.168.43.16
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::386]-I-at+excxxx=ifconfig ra0 | grep 'inet addr:' | sed -e 's/.Mask:(.)/\1/' > /dev/ttyS1
Netmask: 255.255.255.0
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::419]-I-at+excxxx=cat /proc/net/route | grep -e 'ra0[[:space:]]+00000000' > /dev/ttyS1
Gateway: 192.168.43.1
IP Address: 192.168.43.16
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::2074]-I-at+excxxx=iwconfig ra0 | grep 'Link Quality' | sed -e 's/.Link Quality=(.)/.*/\1/' > dev/ttyS1
RSSI: -62 dbm
signal strength (RSSI):-62 dBm
new client
[C:\Users\SATRIO\Documents\Arduino\libraries\WiFiRM04master\utility\at_drv.cpp::235]-I-at+out_trans=0

but the message stopped at that line. i wait until few minutes but nothing happen.. what's wrong?
please help. thank you :)

can't work

hello, i am use mega2560 and pin rm04 same u:
RM04 pins mega2560 pins
UART_RX(pin 20) TX1 (pin 18)
UART_TX(pin 21) RX1 (pin 19)
RXD(pin 22) TX2(pin 16)
TXD(pin 26) RX2(pin 17)
VCC (pin 1, 28) 5V out
pin 10 pin 21
GND GND

but it still
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\91072206\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::936]-I-Can't switch to at mode

:(

Serial was not declared in scope

Hello,
We are using HLK RM04 wifi shield with Arduino UNO,and by importing #include <WiFiRM04.h> this library we are trying to scan the networks,but on compilation we get following error.
C:\Users\shah\Documents\Arduino\libraries\WiFiRM04-master\utility\at_drv.cpp:2207: error: 'Serial1' was not declared in this scope
C:\Users\shah\Documents\Arduino\libraries\WiFiRM04-master\utility\at_drv.cpp:2207: error: 'Serial2' was not declared in this scope
How to resolve this error?

Compiling problem for Arduino Due

Hi,

I am compiling with arduino due, but an error occurs

Can you help me please.
Thanks.

Error message;

In file included from c:\users\ebasarik\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\stdio.h:47:0,

             from D:\Arduino\libraries\WiFiRM04-master\utility/debug.h:13,

             from D:\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:6:

c:\users\ebasarik\appdata\local\arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1\arm-none-eabi\include\sys\types.h:97:24: error: conflicting declaration 'typedef short unsigned int u_short'

typedef unsigned short u_short;

                    ^

In file included from D:\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:4:0:

D:\Arduino\libraries\WiFiRM04-master\utility/socket.h:71:18: error: 'u_short' has a previous declaration as 'typedef uint16 u_short'

typedef uint16 u_short; /**< 16-bit value */

              ^

D:\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp: In member function 'virtual int WiFiRM04Client::read(uint8_t*, size_t)':

D:\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:127:47: error: no matching function for call to 'ServerDrv::getDataBuf(uint8_t&, uint8_t*&, size_t*)'

if (!ServerDrv::getDataBuf(_sock, buf, &size))

                                           ^

D:\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:127:47: note: candidate is:

In file included from D:\Arduino\libraries\WiFiRM04-master\WiFiRM04Client.cpp:12:0:

D:\Arduino\libraries\WiFiRM04-master\utility/server_drv.h:28:17: note: static bool ServerDrv::getDataBuf(uint8_t, uint8_t*, uint16_t*)

 static bool getDataBuf(uint8_t sock, uint8_t *data, uint16_t *len);

             ^

D:\Arduino\libraries\WiFiRM04-master\utility/server_drv.h:28:17: note: no known conversion for argument 3 from 'size_t* {aka unsigned int*}' to 'uint16_t* {aka short unsigned int*}'

exit status 1
Error compiling for board Arduino Due (Programming Port).

echo no resp

sorry for my bad english. i try ScanNetworks, with Arduino Mega R3 without shield.
from http://forum.arduino.cc/index.php?PHPSESSID=tqrfvd90blqdudlatda6oo1516&topic=194175.msg1530972#msg1530972
i try this cable configuration:
RM04 pins mega2560 pins
UART_RX(pin 20) TX1 (pin 18)
UART_TX(pin 21) RX1 (pin 19)
RXD(pin 22) TX2(pin 16)
TXD(pin 26) RX2(pin 17)
VCC (pin 1, 28) 5V out
GND GND

when i read datasheet RM-04. pin 22 and 26 at RM-04 is not TXD and RXD. so i try this configuration
RM04 pins mega2560 pins
UART_RX(pin 20) TX1 (pin 18)
UART_TX(pin 21) RX1 (pin 19)
VCC (pin 1, 28) 5V out
GND GND

and still showing "echo no resp"

i try connecting pin 10 RM-04 to pin 21 Mega
i try to changing the Serial.begin(9600) to Serial.begin(38400)
but still showing "echo no resp"

please help.. thank you

My HLK-RM04 doesn't work.

Hello.Friend.
Thanks for this library!
I have a trouble.
I used HLK-RM04 connect to ap from ConnectwithWEP
Status:
[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::482]-I-Can't switch to at mode
Attempting to connect to open SSID: Yello
[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::936]-I-Can't switch to at mode
Attempting to connect to open SSID: Yello
[D:\±MÃD\arduino\arduino-1.0.6\libraries\WiFiRM04-master\utility\at_drv.cpp::936]-I-Can't switch to at mode

I see the #31 question .and i do same thing .
It does not working.
So help me....
I sorry for my English not well

About wifi signal strength: link quality to dbm

Hi chunlihan,
About convert wifi signal strength to dbm, where did you get this formula?
I want to convert this to dbm to show the actual value of wifi signal strength

// convert link quality to dbm
_networkRssi[numItems] = (_networkRssi[numItems]/2) - 100;

Thanks :)

trouble in connecting to mqtt_sever

it restart...


program_start
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::488]-I-at+wifi_ConState=?

Attempting to connect to WPA SSID: JackHsuan
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::539]-I-at+netmode=2

[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::517]-I-at+wifi_conf=JackHsuan,auto,12345678

[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::556]-I-at+net_commit=1

[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::488]-I-at+wifi_ConState=?

You're connected to the networkSSID: [/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::1984]-I-at+excxxx=iwconfig ra0 | grep ESSID | sed -e 's/.ESSID:"(.)".Nickname:"."/\1/' > dev/ttyS1
JackHsuan
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::358]-I-at+excxxx=ifconfig ra0 | grep 'inet addr:' | sed -e 's/inet addr:(.*).Bcast:.Mask:./\1/' > /dev/ttyS1
Local IP: 172.20.10.13
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::386]-I-at+excxxx=ifconfig ra0 | grep 'inet addr:' | sed -e 's/.Mask:(.)/\1/' > /dev/ttyS1
Netmask: 255.255.255.240
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::419]-I-at+excxxx=cat /proc/net/route | grep -e 'ra0[[:space:]]+00000000' > /dev/ttyS1
Gateway: 172.20.10.1
IP Address: 172.20.10.13
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::2074]-I-at+excxxx=iwconfig ra0 | grep 'Link Quality' | sed -e 's/.Link Quality=(.)/.
/\1/' > dev/ttyS1
RSSI: -61 dbm
signal strength (RSSI):-61 dBm
set sever to connected to the mqtt
set sever success
Attempt to connected to the mqtt
client looping
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::1557]-I-curLocalPort != port
[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::1202]-I-at+CLport=11

[/Users/jackhsuan/Documents/Arduino/libraries/WiFiRM04-master/utility/at_drv.cpp::568]-I-at+reconn=1
program_start


after it connect to the wifi、printWifiStatus, then it just restart...
can you help me plz...

Newbie question

I am newbie in arduino and I not understand very well , how to physically connect the module hlk-rm04 with a mini arduino board . I would like to build a server, that periodically report the status of an Arduino pin, through a wi-fi connection. These modules are connected by a simple serial connection or via an SPI, and how to do this? Thanks !

Does this library support UDP (NTP)?

Hi @chunlinhan ,
I saw words 'Currently, this library doesn't support UDP feature and assign a static IP in client mode.' in 'README', but there do exist codes of WIFIRM04UDP. So does it work on earth? I'm now trying to connect arduino to NTP server by UDP, but did not succeed, I'm wondering if it caused by my mis-use/mis-config or because it is not well supported?

Logs:

time : Sending NTP request.
[WiFiRM04\utility\at_drv.cpp::1019]-I-at+mode=?
[WiFiRM04\utility\at_drv.cpp::258]-I-at+remoteip=?
Remote IP: 129.6.15.28
[WiFiRM04\utility\at_drv.cpp::1111]-I-at+remotepro=?
[WiFiRM04\utility\at_drv.cpp::317]-I-at+remoteport=?
Remote port: 123
[WiFiRM04\utility\at_drv.cpp::596]-I-at+tcp_auto=?
tcp auto: 0
[WiFiRM04\utility\at_drv.cpp::289]-I-at+CLport=?
Local port: 1024
[WiFiRM04\utility\at_drv.cpp::236]-I-at+out_trans=0

Thanks!
And by the way, when I scan wifi, at most 10 ssids are listed. where there should be more. Is that because buffer size is still not enough? how big I can set the buffer size at most?

compling Error

I can not compile ScanNetwork example
shows following error
\utility\at_drv.cpp:2207: error: 'Serial1' was not declared in this scope
\utility\at_drv.cpp:2207: error: 'Serial2' was not declared in this scope

Arduino UNO R3 with IDE 1.0.5-r2

Change network mode and port from arduino

Hi chunlinhan,

i need to change my network mode and local/remote port from arduino mega
because i want to make my RM04 both server and client alternately
i want to update data in xively as server and be a web server in local network.
when my xively library put the data to internet (client mode), network mode changed to "Client" and port "80"
but when i want be a server, the network mode was not changed to "Server" and port still "80", but i need port change to "8080"

how to solve that?
thank you :)

error connecting to atmode atmode

Hi,
Chunlinhan,
I am a newbie in microcontrollers,I have been trying to get my adruino mega connect with RM04 but in vain.. I have tried all your steps but cant connect to atmode... it fails there ... so i am not able to move ahead.. i have connected the tx1 and rx1 pins of mega to rx and tx of RM04 ... and connected there grounds as well... I have modified my hardwareSerial libraries as well as software serieal libraries.... atdrv has also been configures with ESCAPE PIN as 10 as in my RM04. Please help me solve this issue..

thanks
Gurpreet

Use SoftwareSerial mySerial in UNO with the library

Hey chunlinhan

Sorry to bother you again...You have been a great great help and I really appreciate your time.

I am using a UNO, so which mean there is only one hardware serial port.

I would like to connect RM04 with the SoftwareSerial mySerial, so i have changed
image

but after I have saved at_drv.cpp and compile my sketch, it shows
image

Can you please tell me how to modify your library so I can connect my RM04 to a software serial?

BTW, I saw your reply in issue#4
image

You have suggested to use AltSoftSerial Library, so is it better for me to use this library instead of SoftwareSerial library?

And if you prefer to use AltSoftSerial Libary, please tell me that how can i modify your library to work with it a bit in detail

What I have tried with AltSoftSerial Library
image

I changed #include "AltSoftSerial.h" and #define AT_DRV_SERIAL altSerial

But when I compile my sketch i got this
image

Escape pin problem

Hi chunlin:

I'm using your library in uno to build some monitor system prototype with hlkrm04(with shield), during implement the wifi shield can't enter into AT mode. It seems that your lib using pin 21(Mega), but Uno is different one. Pin 21 in mega seems SCL, is this same in UNO?

Can't connect

Hi Chunlinhan,

I tried everything and still can't connect the HLK-RM04 to my arduino mega

*I've checked the baudrates: DEFAULT_BAUD1 and DEFAULT_BAUD2 match the baudrates from the module configuration.
*I've done the connections exactly as per your instructions: http://forum.arduino.cc/index.php?PHPSESSID=tqrfvd90blqdudlatda6oo1516&topic=194175.msg1530972#msg1530972
*I'm using the module HLK-RM04 alone, no shield board

I get this when I try your WifiWebClient example:
Attempting to connect to SSID: routerdelorto
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::936]-I-Can't switch to at mode

With the sample ScanNetworks I get this:
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::482]-I-Can't switch to at mode
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::966]-I-Can't switch to at mode
MAC: 0:0:0:0:0:0
Scanning available networks...
** Scan Networks **
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::119]-I-Echo No resp
[C:\Users\Fernando\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::1879]-I-Can't switch to at mode

Any help will be much appreciated, thank you for reading this!

wifirm04 with arduino UNO

Hi, Thanks for this library!
Is it a way to connect HLK-RM04 to arduino UNO? It seems like it doesn't work on serial port. Can I use softwareserial somehow?

I'm almost giving up. My HLK-RM04 doesn't work.

Dear, I have four HLK-RM04 and do all what others friends and Mr. Chunlinhan suggested, but nothing.
I bought my modules in 2014 and until now, nothing.
So, let's go:

  • I'm connecting the module directly to arduino MEGA 2560 (RM04 to MEGA - Pin 20 to pin 18, pin 21 to pin 19, pin 22 to pin 16 and pin 26 to pin 17).
  • I updated the at_drv.h, at_drv.cpp, HardwareSerial.h and HardwareSerial.cpp like Chunlinhan did.
  • I used the examples from the library.
  • In 192.168.16.254 settings I put the "NetMode" to Default, Ether., Wifi(Cliente) and Wifi(server).
  • I put all baud rate to 9.600, 38.400 and 115.200kbps, and nothing.
  • I use the kit -v2.3 (shield) to connect to arduino and nothing.

So, please, someone can help me?
For now my equipments are still being developed with cable and I think will continue for long time.

With the Example "WifiWebClient" the response is:
[C:\Users\c\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::482]-I-Can't switch to at mode
Attempting to connect to SSID: "MyWifi"
[C:\Users\c\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::936]-I-Can't switch to at mode
Attempting to connect to SSID: "MyWifi"
[C:\Users\c\Documents\Arduino\libraries\WiFiRM04\utility\at_drv.cpp::936]-I-Can't switch to at mode
........

arduino 1.6

Hi!
It seems to me, that WiFiRM04 library doesn't work correct with new arduino version.
Absolutely the same code works great in arduino 1.0.6, but doesn't work in arduino 1.6.
Tested with ScanNetworks example.
Here what I get after burning arduino with this example:

[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::482]-I-Can't switch to at mode
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp
[/home/dedxoxo/Arduino/libraries/WiFiRM04/utility/at_drv.cpp::119]-I-Echo No resp

Arduino UNO keep reading the page, doesn't stop

I have written a simple code and just try to reduce unnecessary stuff posting on Serial monitor since i have connected my RM04 to the same serial port that is for the serial monitor.

I have tried this code
image

and i have got my result in my serial monitor
image

but after i got this part

image

It doesn't want to stop, it keeps reading and show this

image

how can i stop RM04 or Arduino from keep reading, I just want it to show the page once.

Thank you for your time again

Hooking up to Arduino.

Hi.

How do you hook this up to an Arduino? I have tried connecting the RX/TX cables from the HKL-RM04 to my Arduino's D0-1 but I only get junk as out put. Have tried both Serial ports ont he WifiUnit with no luck.

I have checked the baud rate and that is the same set on the RM04.

Tried it with a CP2104 aswell and it returns the same char's.

Am I missing something? Any help will be appreciated... ;)

compile error with WiFiRM04 & Arduino1.6.5

Getting the build fail with below error:

Arduino: 1.6.5 (Windows 7), Board: "Arduino Uno"
Sketch uses 30,096 bytes (93%) of program storage space. Maximum is 32,256 bytes.
Global variables use 3,175 bytes (155%) of dynamic memory, leaving -1,127 bytes for local variables. Maximum is 2,048 bytes.
processing.app.debug.RunnerException: Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
at processing.app.debug.Compiler.size(Compiler.java:343)
at processing.app.debug.Compiler.build(Compiler.java:122)
at processing.app.Sketch.build(Sketch.java:1109)
at processing.app.Sketch.build(Sketch.java:1084)
at processing.app.Editor$BuildHandler.run(Editor.java:1955)
at java.lang.Thread.run(Thread.java:745)
Not enough memory; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing your footprint.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

It seems that no enough dynamic memory to use which exceed 2048 size. Do you have any idea about this error?

compatibility for arduino ide 1.6.3

I know that this library can work fine with arduino ide 1.0.6. I need to use the ide 1.6.3 new features but I can't because the lib is not working on this ide version. Can I do something to make the rm04 library or arduino code compatible? in ide1.6.3 I can easily set up a specific serial buffer size greater than 512 bytes but in 1.0.6 you can't or it's not easy to do. Hope somebody can help me. Thanks in advance.

Doesn't show more than 5 ssids

For some reason I'm only showing 5 ssids. I have my max set to 20. any thoughts? Also I'm using your updated serial buffer files.

configuration

Hi,

You are so amazing!

I have just bought a HLK-RM04.. now I am trying to work on my project with an Arduino Mega 2560. I have a few of doubts, hopefully you may assists me on this.

My testboard is something like this..is your library support this testboard and Arduino Mega 2560.or do I have to reconfigure it?

http://item.taobao.com/item.htm?spm=a230r.1.14.229.FWZEEF&id=36775715936

I have downloaded your library and try on my MEGA with the setup as below:

1656153_10203171335874759_2113967739_n

I try to run the ScanNetworks example but this is what I got from the serial monitor. Any Idea what is the issue?

capture

and regarding to your note "First and most important, MUST modify Arduino's serial driver to increase Rx buffer size or add hardware flow control support, because HLK-RM04 will try to output all data at once. If Rx buffer of your serial port is too small(or no hardware flow control support), you will lose those data."...Can you please guide me how to modify the arduino's serial driver?

Thanks.

Regards,
levichong

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.