1

I'm developing a little project with arduino, using a small web page to show data. Well, I have been develop the web page and the small code to communicate with arduino board in my local computer and all work fine. But, after, i uploaded the code to a Raspberry Pi and then the problems appear. This is very strange, because when I execute the code inside a WSGI like django (in my case is other, webapp2) the code works well. I call a specific URL and this WSGI call a method inside a class that communicated with the arduino board through serial port, so far, so good. The problem appears when I decided build a method to execute the lines that do the communication, in this moment arduino does not response and only lights the led number 13 and the 'L' led twice (the led inside the board).

I don't understand why this happens. The code is exactly the same. Any idea?

For the other hand, because í don't have GUI in the raspberry I don't can view the serial port communication easy. Do you know any way to view or debug the serial communications between a pc and arduino without GUI, over the command line?

This is the code:

# -*- coding: utf-8 -*-
import serial
import time

arduino=serial.Serial('/dev/ttyACM0', baudrate=9600, timeout=3.0)
arduino.close()
arduino.open()

sensorTemp=''
arduino.write('a')
while arduino.inWaiting() > 0:
        sensorTemp+=arduino.read(1)
print sensorTemp

Thanks you so much. Any idea is welcome.

  • Show us some code. We can only guess otherwise. – gre_gor Dec 19 '15 at 22:20
  • Sorry, my fault. :) – Juan Antonio Dec 19 '15 at 22:23
  • 3
    Opening the port typically resets the arduino and incurs the bootloader delay (causing it to miss your 'a') unless you change the hupctl setting. It has been covered in existing questions here. – Chris Stratton Dec 20 '15 at 1:03
  • 1
    You can SSH to the PI, then use ```screen /dev/ttyACM0´´´ to open the serial port to the Arduino (when nothing else is using it) just to make sure the Arduino is behaving. – TwoD Dec 21 '15 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.