Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,078 Views

How to start my arduino code when i boot my intel edison board

Hello,

My arduino code works fine when I load it to the edison board through the arduino IDE. I want my code to work as soon as I supply power to my intel edison board.

Please suggest me what can be done for the same.

I want the following steps to be executed when i boot the device.

1. Connect my edison to the wifi.

2. Start my arduino sketch which send data to the cloud using MQTT broker.

Thanks in advance.

Regards,

Parth Desai

0 Kudos
9 Replies
idata
Community Manager
100 Views

Hi Parth,

 

 

This is actually a bug, but there's a workaround that solves it. You can find the instructions here:

 

/thread/77945 https://communities.intel.com/thread/77945.

 

Now, on step 5, instead of downloading and flashing image 159, download and flash the latest one from the Edison Download Center (which possibly you're already using) and proceed with the rest of the steps.

 

Hopefully this will solve your problem.

 

 

Regards,

 

-Pablo
idata
Community Manager
100 Views

Hey Pablo,

Thanks for the solution, I have already tried it but am still not able to run the code on bootup.

My device connects to the internet on reboot but the MQTT broker is not connected so I cannot send or receive the data from my edison board.

When I load the code through the virtual COM port it the code works fine. The data even stops when I remove my microUSB from the host mode.

Can you please suggest the solution for the same as I want my device to send data when it is powered on.

Regards,

Parth

idata
Community Manager
100 Views

Hi Loop,

 

 

It might be possible that the MQTT service is being started after the Arduino sketch service, so this could be the reason for the sketch not working. Could you please try to turn off the MQTT service and run the Arduino sketch? Do you get a similar behavior?

 

If so, you could set the Arduino sketch service (the one you did with the tutorial from my last post) to start once all other services have been initiated. Hopefully this will solve the issue.

 

 

Regards,

 

-Pablo
idata
Community Manager
100 Views

Hey Pablo,

My Arduino sketch itself starts the MQTT service. If I remove the cable or reboot my device then the code does start automatically but I am not able to send or receive messages on to the server ( which works fine with the cable connected).

I do not know why I am getting such kind behavior.

Please let me know any steps to debug/ resolve the problem.

Regards,

Parth Desai

idata
Community Manager
100 Views

Hi Loop,

 

 

Could you please try to take out the part of the code that starts MQTT? Try to start it with a new service (outside the Arduino sketch). I would like to see what happens if you isolate this section of the process. Remember that you'll need to run this new service before you run the service that starts the Arduino sketch.

 

Please let us know your results once you try this.

 

 

Regards,

 

-Pablo
idata
Community Manager
100 Views

Pablo,

Without the MQTT code the arduino code will run fine as I tried to run the blinky program on reboot and it worked fine.

The main part of the code is the MQTT service which connects my device to the internet and then sends he data to the cloud and when any data from the cloud is given as an input to the device then it is displayed on the LCD connected to the arduino board.

So without the MQTT code it would be just starting the LCD and display random text on which. The LCD does start on reboot but the MQTT does not.

I do not know how to diagnose this issue.

Regards,

Parth

idata
Community Manager
100 Views

Hi Loop,

 

 

It is not necessary to take out the part of the code that sends the data to the cloud, just the initialization of MQTT, which implies writing a service that starts MQTT before the Arduino sketch starts. You still can keep the data handling part in your Arduino sketch. We want to determine what's generating the issue, so this test is part of that.

 

 

Regards,

 

-Pablo
idata
Community Manager
100 Views

Hey Pablo,

Without the MQTT borker my data will not be send to the cloud.

I can send you the code if you can be kind enough to post your email id here.

The Arduino code runs fine as I said before.

You can analyze the code and let me know if I am going wrong somewhere.

Regards,

Parth Desai

idata
Community Manager
100 Views

Hi Loop,

 

 

That's a good idea, I would like to take a look at your code. If you don't want to post it here, you can send me the code through private message. Search me as PabloM_Intel, go to my profile and text me with your code.

 

 

Regards,

 

-Pablo
Reply