Communication and compiling problem[SOLVED]

Hi everyone ,
first of all I am already sorry for my english, I’m french so be nice and ask if you don’t understand what I’m talking about …

Here’s my problem , I just installed jessie raspbian for robots on my rpi3, everythings going well i’m trying to send a char from the arduberry and receive it via a little python program that just read my serial and all of that works. Now when I’m trying to follow the little tutorial with the pySerial.py programm nothing works …

My second problem is that I used a Funduino Uno so it’s just really the same chip ATMEGA 328P before I bought the Arduberry 2.0 all my program was compiling and working but I can’t use this on the arduberry, if you can give me some help it would be really great.

Thank you

Hi amaury,
Which image are you using with the Raspberry Pi and can you post the program that you are using with pyserial so that we can look if there’s any problem there. Also, did you make sure that the baud rate is the same in the python program as the sketch that you have loaded on the Arduberry.

Are you getting a problem when compiling the program in the Arduino IDE. Can you post a screenshot of the error you are getting.

-Karan

Hi, thank to answer that quick

For the image on the raspberry I used Jessie Raspbian for Robots , the last version and fully upgraded and updated .
My problem fir the pySer.py programm is that i can’t read nothing on the terminal when I execute the python program. I just use the exemple on github for the python : https://github.com/DexterInd/Arduberry/blob/master/Software/Python/pySer.py
and using the example for arduino as said in the tutorial here : https://github.com/DexterInd/Arduberry/blob/master/Software/Arduino_sketch/serial_arduberry.ino

I also checked if the baud rates were equals and they are. The program is compiling and uploading on the arduberry without any problems, I use the Arduino Uno as board and the GPIO Programmer.

Anyway except that I tried to just read some Digital input on the arduberry ( DHT22 temperature and humidity sensor) and it works. I can read the values on the serial monitor. But when I’m trying to compile my old program which was on a arduino before it doesn’t work I got the error which is in the attachments.

Can’t upload the full program for arduberry if you wan’t it tell me how to do.

Not really sure what’s going wrong there. I just tried the example and it works properly for me. I wrote a simpler Arduino Sketch and a simpler Python program(attached here). Can you try those out and see if they work any better.

First compile and upload the serial_arduberry_basic sketch to the Arduberry. Use the programmer as Raspberry Pi GPIO and use File -> Upload Using Programmer to upload to the Arduberry (check attached screenshot). Next select the Serial port at /dev/ttyS0 and open the serial port monitor(check attached screenshot) and you should start seeing the data there(check attached screenshot). If this works, close the serial port monitor and then run the python program and you should see the data there(check attached screenshot).

For the problem that you are getting with the program that you had written for the Funduino, it looks like there is a problem with the libraries or one of the external variables. Were there any other external libraries that were used with it? If so then you’'ll have to install it on the Raspberry Pi too. If you are unable to find what’s causing the problem, you can upload the program here too and I can try compiling it here and see if it works.

-Karan

Looks like I can only attach 4 files to a post. Here is the python program and arduberry sketch.

Hello,
thanks for your help , my problem with the python program seems to be solved with this simpler program I thin that came from the send function.

For the program I wrote myself I need to get values from a DHT 22 (temperature and humidity sensor) so here is one library then an ADXL345 (accelerometer) second library and a sensor that works with the second one and finally the emonlib library that allow me to get values from a ct sensor. I’ll join my program here see if you can compile. I just saw that i have an old version of Arduino IDE on the RPi should it cause my problem ? I also add libraries on the Rpi so don’t know where it come from …

My program allow me to get those values and send them in a thread on my Raspi that treat all of the info and send tehm into a database with a python program.

Ok I’m back I tried to import all of my libraries wich where in my pc where the program compiling works seems to be okfor the last error but still can’t find Wire .h could you tell me how to generate the base libraries or how to update the arduino IDE version that is the 1.0.5

EDIT :
I found something on the internet to upgrade the Arduino IDE version to 1.6.0 the program compile but of course when I’m doing the installation all of the configuration is lost. I mean the Raspberry GPIO Programmer, the /dev/ttyS0 go into /dev/ttyAMA0 so I can compile but can’t load it on the Arduberry.

Wire.h should be a part of the default Arduino package and should be preinstalled. Did you get the program to compile after updating to Arduino IDE 1.6. To do the custom installations, you should run the commands here: https://github.com/DexterInd/ArduBerry/blob/master/script/install.sh#L93-L101 one by one on the terminal.

-Karan

I used this http://duinorasp.hansotten.com/arduino-1-6-x-for-raspberry-pi-jessie/ to upgrade to 1.6 version then i can compile but all the configuration is lost i’m actually going to try to run all the commands one by one but I doubt it will work, coming back to you on monday if it still doesn’t work !

Amaury

EDIT : The wire library is in the library file and imported in the Arduino IDE but he can’t find it, When i put them out of the src file it’s ok but I have others problems with other libraries I’ve seen that old versions of arduino IDE had some troubles finding the libraries and it seems to be true 'cause when i’m upgrading it, it is compiling , what a mess ^^

Edit 2 : here is what I got after upgrading and running every commands one by one

It does look like the problem is with the programmer. You should have Raspberry PI GPIO in the programmer section, then only it’ll upload. Can you let me know if the scripts help you out.

-Karan

I already linked you what I got in the Arduino IDE after that I upgraded to the 1.6 and run all the commands that you told me to run one by one. I even tried to run the install.sh it’s still the same .

Maybe Arduino IDE 1.6 does not work with those scripts. Can you post the code that you were trying to run, I can try running it on a similar setup and find out what’s causing the error.

-karan

I already linked it in a preview post i just give it to you back again, please tell me if you see a solution . Or you maybe know how may I setup a new programmer manually ?

I was able to compile the sketch with a few changes. You were right, the Arduino IDE on the Pi causes some problems because the libraries are older and I was not able to get the newer IDE to work properly. What I ended up doing was to update the libraries which were causing the problem and then getting the program to compile.

To compile the program, copy the zip attached here to the Pi and unzip it. I have renamed the sketch to emon_test.ino. Next, open the terminal and goto the folder where you have extracted the contents and run these commands to update the libraries which were causing the problem: sudo cp WString.h /usr/share/arduino/hardware/arduino/cores/arduino/ then sudo cp WString.cpp /usr/share/arduino/hardware/arduino/cores/arduino/ (See screenshot).

Next, open the emon_test.ino in the Arduino IDE and compile. It should work now (see screenshot). Make sure that you are using the Arduino IDE 1.0.5 so that you can upload the program.

Sorry for the troubles, we didn;t know that there were problems with the Arduino 1.0.5 IDE and we’ll update the IDE to 1.6.5 as soon as we finish testing the IDE and make sure that everything works properly with it.

-Karan

I just tried to see if it works and it is , I can read my thread in the arduino serial monitor. That’s really awesome !

Thanks for your help I’m happy to know that you know found some issues and that your looking to upgrade the arduino IDE version.

see ya !