Introduction: Use the Dragino HE and Mega328p to Build an Arduino Yun Alike Solution

In this project, we will make an Arduino Yun alike solution by using Dragino HE、mega328p and other components.

Over here, we will build an Arduino Yun alike solutiom and show how to program the mega328p via WiFi. and how to demo communication between mega328p and the Dragino HE Linux IoT WiFi module.

If you want to do this yourself, you're going to need:

  • 1 x Dragino HE(Preload with Dragino Yun Firmware)
  • 1 x Mega328p
  • 1 x Breadboard
  • 2 x 4.7k Ohm resistors

  • 1 x 1M Ohm resistor
  • 1 x 0.1uf Capacitor
  • 2 x 22pf Capacitors
  • 1 x 16MHZ Crystal oscillator
  • 1 x Antenna
  • 1 x NPN 9014
  • 1 x 12v to 3.3v Power Module
  • a bunch of jumper wires

Step 1: A Brief Introduction of the Dragino HE

HE is a high performance, low cost 150M, 2.4G WiFi module. It is compatible with 802.11b/g/n. provide Ethernet, USB, UART and GPIOs interface. HE use small outline package, it is used widely in WiFi solutions.

HÉ means “core” in Chinese. Intend of HÉ module is to be used as the core of the IoT, WiFi solution.

HE is based on Open Source OpenWrt system. User is free to modify the software for their applications.

You can click this link to get more information: http://wiki.dragino.com/index.php?title=Dragino_HE

Step 2: Hardware Connections

Follow the Fritzing Diagram and connect the hardware.Be careful,and it will be easier to complete.

We should pay more attention to the pins between mega328p and HE:

MEGA328P SS <--> HE GPIO23

MEGA328P MOSI <--> HE GPIO21

MEGA328P MISO <--> HE GPIO22

MEGA328P SCK <--> HE GPIO18

MEGA328P RESET <--> HE GPIO20 via transistor(invert level)

In this project, we power the HE and Mega328P both with 3.3v power,so we don't need to add level shift in between the mega328p and HE.

Please send me a comment/question if unsure.

Step 3: Connect Your Computer to the Dragino HE

Wait a few minutes after powered the Arduino Yun alike solution,you will see an unsecure WiFi network call Dragino-xxxxxx.Use your computer to connect to this WiFi network.Your computer will get an IP 192.168.240.xxx and the Dragino HE has the default IP 192.168.240.1

Simply type the IP address into your browser and you will see the log in page of HE.Default User name and Password for it is root/dragino.

Click the Configure button and now we can configure the device password and network parameters.

Please check this link for how to connect your computer to the Dragino HE: http://wiki.dragino.com/index.php?title=Yun_Shield

Step 4: Choose the Correct Board and Port

In Arduino IDE, the board type should select Arduino Uno-Dragino Yun.Then choose the correct port. (should be Arduino Yun port with an ip address)

Step 5: Edit Sketch

The Dragino HE booting process can be interrupted by UART port in early 3 seconds. The mega328p will keep sending UART data when bridge.begin() start.

So we would better add a delay(8000) before start the bridge to prevent mega328p stop HE during booting. in the real system, we can use a 3 status buffer(shown mega328p) or level shift (Shown in Yun Shield) for this purpose.

Step 6: Upload Sketch

Compile the sketch and upload it . During upload, the Dragino HE will ask you to key in the password, by default, the password is dragino.

Step 7: Example:Control the LED With a Browser

According to the steps above to build the simple arduino Yun.

Then complete the following Operation.

Power the HE and Mega328P both with 3.3v power.

Connect to its WiFi network.

Open the IDE and configure it.

Over here ,we use the built-in example sketch from Arduino IDE-->Examples-->Bridge-->Bridge

Modify the code,add a delay(8000) before start the bridge.(To prevent mega328p stop HE during booting)

Compile the sketch and upload it to the Arduino Yun alike solution.(The Arduino Yun alike solution will ask you to key in the password, by default, the password is dragino.)

As we see in the video,we use a phone browser with the URL structure here.Simply type the IP address into your browser and you will see the log in page of the Dragino HE,default User name and Password for HE is root/dragino.

After the operation is complete,we can type the commands as below to control the LED:

http://192.168.240.1/arduino/digital/13/1 to set the digital pin 13 to high hence turn on the LED.

http://192.168.240.1/arduino/digital/13/0 to set the digital pin 13 to low hence turn off the LED

Step 8: Once This Is Done, Just Do More Interseting Things!!!

For more info about Dragino HE, please refer:

http://wiki.dragino.com/index.php?title=Dragino_HE... or contact us at info@dragino.com