Need Help with the Iduino Yun Shield on a Mega2560

Post Reply
charcuterie
Posts: 3
Joined: Sat Sep 17, 2016 11:38 am

Need Help with the Iduino Yun Shield on a Mega2560

Post by charcuterie » Sun Sep 18, 2016 10:04 am

Hi, I am new to Arduino but I have managed to get my board to run a temp/humidity sensor and upload the data to thingspeak via ethernet cable.

I now want to do this via wifi so I dont need the connected ethernet cable.

I have an Arduino Mega 2560 board and have placed the Iduino Yun shield V1.2 onto it,

I have been able to connect directly (Laptop<->iduino yun shield) via wifi to the shield and set it up and then reconnect via my home wifi network (Laptop<->wifi network WPA2<->iduino yun shield), this all seems to be working fine.

I have placed the jumper on the mega16u2 bridge mode reset pins on the Arduino mega 2560 board (though 1 site says you dont need to do that now)

I have uploaded sketches both directly from the arduino IDE and have also tried via hex file upload via the iduino yun shield settings page)

I have updated the Geeetech Iduino Yun shield (v1.2) to the dragino firmware V 2.0.7 (one site suggested this will help)

I initially had troubles updating the board.txt file but a great text editor called Boards.txt helped sort that out

I have added and tried both these settings for dragino and arduino in the board.txt file

##############################################################
mega2560Yun_Dragino.name=Arduino Mega 2560 -Dragino Yún
mega2560Yun_Dragino.build.mcu=atmega2560
mega2560Yun_Dragino.build.f_cpu=16000000L
mega2560Yun_Dragino.build.core=arduino:arduino
mega2560Yun_Dragino.build.variant=arduino:mega
mega2560Yun_Dragino.build.board=AVR_MEGA2560
mega2560Yun_Dragino.upload.tool=arduino:avrdude
mega2560Yun_Dragino.upload.protocol=arduino
mega2560Yun_Dragino.upload.maximum_size=258048
mega2560Yun_Dragino.upload.speed=57600
mega2560Yun_Dragino.upload.disable_flushing=true
mega2560Yun_Dragino.upload.use_1200bps_touch=true
mega2560Yun_Dragino.upload.wait_for_upload_port=true
mega2560Yun_Dragino.upload.via_ssh=true
mega2560Yun_Dragino.upload.maximum_data_size=8192
mega2560Yun_Dragino.bootloader.tool=arduino:avrdude
mega2560Yun_Dragino.bootloader.low_fuses=0xff
mega2560Yun_Dragino.bootloader.high_fuses=0xd8
mega2560Yun_Dragino.bootloader.extended_fuses=0xfd
mega2560Yun_Dragino.bootloader.file=arduino:stk500v2/stk500boot_v2_mega2560.hex
mega2560Yun_Dragino.bootloader.unlock_bits=0x3F
mega2560Yun_Dragino.bootloader.lock_bits=0x0F
mega2560Yun_Dragino.vid.0=0x2341
mega2560Yun_Dragino.pid.0=0x0044
mega2560Yun_Dragino.pid.1=0x003f
mega2560Yun_Dragino.vid.1=0x2341
##############################################################
mega2560Yun_Iduino.name=Arduino Mega 2560 -- Iduino Yún
mega2560Yun_Iduino.build.mcu=atmega2560
mega2560Yun_Iduino.build.f_cpu=16000000L
mega2560Yun_Iduino.build.core=arduino
mega2560Yun_Iduino.build.variant=mega
mega2560Yun_Iduino.build.board=AVR_MEGA2560
mega2560Yun_Iduino.upload.tool=avrdude
mega2560Yun_Iduino.upload.protocol=arduino
mega2560Yun_Iduino.upload.maximum_size=258048
mega2560Yun_Iduino.upload.speed=57600
mega2560Yun_Iduino.upload.disable_flushing=true
mega2560Yun_Iduino.upload.wait_for_upload_port=true
mega2560Yun_Iduino.upload.via_ssh=true
mega2560Yun_Iduino.upload.maximum_data_size=8192
mega2560Yun_Iduino.bootloader.tool=avrdude
mega2560Yun_Iduino.bootloader.low_fuses=0xff
mega2560Yun_Iduino.bootloader.high_fuses=0xd8
mega2560Yun_Iduino.bootloader.extended_fuses=0xfd
mega2560Yun_Iduino.bootloader.file=stk500v2/stk500boot_v2_mega2560.hex
mega2560Yun_Iduino.bootloader.unlock_bits=0x3F
mega2560Yun_Iduino.bootloader.lock_bits=0x0F
mega2560Yun_Iduino.vid.0=0x2341
mega2560Yun_Iduino.pid.0=0x0044
mega2560Yun_Iduino.bi.upload.use_1200bps_touch=true




Now I am able to upload this following sketch..................................


#include <Console.h> //use Console class for Arduino IDE debug over WiFi, similar to Serial class,
String name;

void setup() {
// Initialize Console and wait for port to open:
Bridge.begin();
Console.begin();

// Wait for Console port to connect
while (!Console);

Console.println("Hi, what's your name?"); //Data flow: Arduino --> Yun Shield --> Arduino IDE
}

void loop() {
if (Console.available() > 0) {
char c = Console.read(); //read the next char received, data flow: IDE --> Yun Shield--> Arduino
// look for the newline character, this is the last character in the string
if (c == '\n') {
//print text with the name received
Console.print("Hi ");
Console.print(name);
Console.println("! Nice to meet you!");
Console.println();
// Ask again for name and clear the old name
Console.println("Hi, what's your name?");
name = ""; // clear the name string
}
else { // if the buffer is empty Console.read() returns -1
name += c; // append the read char from Console to the name string
}
}
}



But when I open the serial monitor in the arduino V1.6.11 IDE is dosnt connect and says is the sketch using the bridge?

I suspect there is a problem either with my sketch or the bridge or some uploading issue of the sketch, though it appears to upload correctly.

there is a section talking about bridge issues and sketch upload issues on this webpage but it seems very technical to me
http://www.geeetech.com/wiki/index.php/ ... Yun_Shield


I have spent 3 days trying to make this work, I have scoured the forums but I now submit to needing some help with this. As I mentioned I am new to this technology and I am sure I am missing something simple.

David

User avatar
William
Site Admin
Posts: 6340
Joined: Tue Jun 07, 2016 9:38 am

Re: Need Help with the Iduino Yun Shield on a Mega2560

Post by William » Sun Sep 18, 2016 10:50 am

Didnt't the users manual help?
-Keep your mind and try to test it. :)
-Everything will be fun!-Support all Getech printer.
-You can ask me the questions and I will kindly reply.
-Respect others is the best way you can get help!

charcuterie
Posts: 3
Joined: Sat Sep 17, 2016 11:38 am

Re: Need Help with the Iduino Yun Shield on a Mega2560

Post by charcuterie » Sun Sep 18, 2016 12:59 pm

Thanks for the reply,

I have spent 3 days going over the manual, I seem to be able to upload the sketch via the arduino IDE but if I upload a HEX version from within the idunino yun shield i get

Uploading sketch...
Bootloader stk500v2/stk500boot_v2_mega2560.hex will be added to the sketch
Previously running Bridge terminated.
Error while running avrdude

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


When I have uploaded a sketch via the arduino IDE and open the serial monitor I get
Unable to connect...retrying
.....
....
Unable to connect : is the sketch using the bridge?

What should I try next???

User avatar
William
Site Admin
Posts: 6340
Joined: Tue Jun 07, 2016 9:38 am

Re: Need Help with the Iduino Yun Shield on a Mega2560

Post by William » Sun Sep 18, 2016 2:12 pm

-Keep your mind and try to test it. :)
-Everything will be fun!-Support all Getech printer.
-You can ask me the questions and I will kindly reply.
-Respect others is the best way you can get help!

charcuterie
Posts: 3
Joined: Sat Sep 17, 2016 11:38 am

Re: Need Help with the Iduino Yun Shield on a Mega2560

Post by charcuterie » Wed Sep 21, 2016 6:24 am

Thanks for that last link William Kwok,

I needed the 5V jumper, i initially placed it as per your diagram in the link but it didnt work so I tried the other jumper setting and it worked but when i looked at the board under a magnifying glass the 5V was the correct setting just back to front from the diagram.

Once again thankyou very much

fredericci
Posts: 1
Joined: Fri Jan 27, 2017 5:52 pm

Re: Need Help with the Iduino Yun Shield on a Mega2560

Post by fredericci » Fri Jan 27, 2017 7:12 pm

yun shield is not stable. i have same issues with some shield.. ethernet port shutdown... unconnected uno board.. depending of shield..
anyway with the v1.1 and firmware 2.07 i had better issue
you should use the new board list : http://www.dragino.com/downloads/downlo ... index.json
with any uno/mega without jumper
in your sketch use

#include <Bridge.h>

setup
Bridge.begin();
Console.begin();

Console.print("blabla"); to see result in serial monitor

do not use pins 10/11/12/13 for other purpose and RX/TX as weel to maintain connection between uno and yu shield
hope this can help

Post Reply