Difference between revisions of "CuHead Pro WiFi/Ethernet Shield with AirPlay/DLNA Audio for Arduino"

From LinkSprite Playgound
Jump to: navigation, search
(Description)
Line 11: Line 11:
  
 
====Product List====
 
====Product List====
*1 X [http://linksprite.com/wiki/index.php5?title=%E5%86%85%E5%AD%94SMA-IPX_%E5%A4%A9%E7%BA%BF%E8%BF%9E%E6%8E%A5%E7%BA%BF  内孔SMA-IPX 天线连接线 for cuhead por wifi ][IT_ANTCAD_SMA-IPS] [AA101107]
+
*1 X [http://linksprite.com/wiki/index.php5?title=%E5%86%85%E5%AD%94SMA-IPX_%E5%A4%A9%E7%BA%BF%E8%BF%9E%E6%8E%A5%E7%BA%BF  SMA-IPX for cuhead por wifi ][IT_ANTCAD_SMA-IPS] [AA101107]
 
*1 X [http://linksprite.com/wiki/index.php5?title=Wifi%E6%A8%A1%E5%9D%97 wifi模块 cuhead por] [IT_WIFI_CUHPOR] [FC101101]
 
*1 X [http://linksprite.com/wiki/index.php5?title=Wifi%E6%A8%A1%E5%9D%97 wifi模块 cuhead por] [IT_WIFI_CUHPOR] [FC101101]
 
*1 X [http://linksprite.com/wiki/index.php5?title=Cuhead_por_Shield%E5%BA%95%E6%9D%BF cuhead por Shield底板] [IT_SHD_CUHPOR] [FD101101]
 
*1 X [http://linksprite.com/wiki/index.php5?title=Cuhead_por_Shield%E5%BA%95%E6%9D%BF cuhead por Shield底板] [IT_SHD_CUHPOR] [FD101101]
 
 
  
 
== Interface ==
 
== Interface ==

Revision as of 07:53, 28 August 2014

Description

What is CuHead Pro WiFi/Ethernet Shield with AirPlay/DLNA Audino for Arduino? It is a WiFi Shield, it is an Ethernet Shield, it accepts audio pushed from iphone, iPad, Android phone or pad Wirelessly.


SHD WIFI CUHPRO1.jpg


SHD WIFI CUHPRO2.jpg


Product List

Interface

Lets explain the interfaces:

  • USB host is reserved. It is for firmware updated in the future so that USB webcam can be used.
  • Ethernet RJ45 port. It is used for Ethernet communication where there is no WiFi signal, or where the WiFi Signal is bad.
  • Audio jack. It accepts any three segments audio jack.
  • J7 is the header used to choose which pins of Arduino are used to communicate with CuHead Pro. CuHead Pro can communicate with Arduino transparently through the UART interface. Please don't use D0 and D1. This is because that the hardware UART on Arduino TX/RD are pulled low during power up, and unfortunately CuHead pro will check its UART too during power up. If its pulled low, it will not start. So we can only use software serial port of Arduino to communicate with CuHead Pro.

Audio Push

First, lets look at interesting application. We are going to push music from iPhone to CuHead pro.

Lets make sure that J7 is configured so that pins 6 and pins 7 are installed as following:


Cuhead pro iphone 1.jpg

Install CuHead Pro on Arduino, and Arduino is connected to PC through USB connection. Yes. PC's USB can supply current for CuHead Pro.

When powered up, we can see four green LEDs of WiFi module turned on.

Cuhead pro iphone 2.JPG

After several seconds, there are only two LEDs still on, and they are steady on.

Cuhead pro iphone 3.JPG

Wait for another minute or two, the two LEDs will start to blink. This indicates that WiFi module is ready for use. We use iPhone to scan for WiFi network, and can see that there is a new AP, which is made by CuHead Pro. CuHead Pro works in AP client mode. It is a AP itself, so that it can provide AP service for other WiFi client. It can also connect to a router in home for Internet connection. From this point of view, it works more like a WiFI repeater.

We connect to the AP made by Cuhead Pro:

Cuhead pro iphone 4.JPG

Open the music application, we can see that there is an AirPlay icon in the lower right. Click the little triangle:


Cuhead pro iphone 5.JPG

Click AirPlay, we can select the device that will be used to play the audio:

Cuhead pro iphone 6.JPG

After couple of seconds, the music will show up in the audio jack. Is it amazing?

What about cloud music? We can configure CuHead Pro to connect to the router in office or home.

Launch a browser, and enter 10.10.10.254. Note that iPhone need to connect to CuHead Pro AP.

Cuhead pro iphone 7.JPG

Click the icon named WiFi, and we can see many APs:

Cuhead pro iphone 8.JPG

Select the router that we intend to connect, and input password:


Cuhead pro iphone 9.JPG

Now CuHead Pro is on the Internet, and we connect iPhone to the same router and we can stream audio from Internet.


TCP to UART Communication

The following work will be done on a PC.

First, we need to configure PC to connect to the AP of CuHead Pro. Please make sure that CuHead Pro is powered up and starts up properly.


Cuhead pro tcp 1.jpg


Open a web browser, and enter 10.10.10.254:


Cuhead pro tcp 2.JPG

Click System, and we can check the version of firmware loaded on the WiFi module:

Cuhead pro tcp 3.JPG

If the version is lower than 1.2.1491, we need to upgrade our firmware before continue. Version 1491 can be downloaded here. Click Status->Firmware update to upgrade.

There are three IPs we need to make sure we can distinguish them:

  • When CuHead Pro works as an AP. It will assign an IP to itself. This IP address is always 10.l0.10.254. This IP address is only valid if PC is connected to CuHead Pro AP.
  • Wireless IP: This IP address is assigned to CuHead Pro when it connects to the office router. If our PC is also connected to the same router, we can access CuHead Pro using this IP address.
  • Ethernet IP: This IP address is assigned to CuHead Pro by the router when CuHead Pro is connected to router by Ethernet cable. If our PC is also connected to the same router wireless or by cable, we need to use this IP address to access CuHead Pro.

In the UART tab, we can configure the baud rate of the WiFi module:

300,600,1200, 1800, 2400, 4800, 9600, 19200, 38400, and default to 9600.


Cuhead pro tcp 4.JPG

Now, let's look at Arduino code:


<syntaxhighlight lang="c"> /*

 Software serial multple serial test

Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.

The circuit: 
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)

Note:
Not all pins on the Mega and Mega 2560 support change interrupts, 
so only the following can be used for RX: 
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

Not all pins on the Leonardo support change interrupts, 
so only the following can be used for RX: 
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example

This example code is in the public domain.

*/
  1. include <SoftwareSerial.h>

SoftwareSerial mySerial(6, 7); // RX, TX

void setup() {

 // Open serial communications and wait for port to open:
 Serial.begin(9600);
 while (!Serial) {
   ; // wait for serial port to connect. Needed for Leonardo only
 }


 Serial.println("Goodnight moon!");
 // set the data rate for the SoftwareSerial port
 mySerial.begin(9600);
 mySerial.println("Hello, world?");

}

void loop() // run over and over {

 if (mySerial.available())
   Serial.write(mySerial.read());
 if (Serial.available())
   mySerial.write(Serial.read());

} </syntaxhighlight>

The code works by copying data back and forth between the software serial port where CuHead Pro is using and the hardware serial port of Arduino.

On the PC, we can use a TCP/IP debug program.

The following is the screen shot showing the bidirectional communication between TCP and UART:


Cuhead pro tcp 5.JPG

Resources

How to buy

Here to buy CuHead Pro on store