2

**EDIT: I am receiving the following error message:* "Error retrieving accessibility bus address: or.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files"

I wrote code for the PC platform using Python and it works just fine. I was looking to have this program run on a rasberry pi connected to a monitor.

I installed Raspbian and all of the libraries for the above needed functions.

The code is as follows:

############################################################
# Visualizing data from the Arduino serial monotor         #
# and creating a graph in a nice format. Later work will   #
# look into outputting this to a Android device            #
############################################################
############################################################

############################################################
############################################################

#Becuase we can always use more time
import time

#Inport the fancy plotting library 
import matplotlib.pyplot as plt

#Inport the serial library
import serial

#We want to do array math so we need Numpy
import numpy

#We also want to draw things so we need drawnow and
#everything that comes with it
from drawnow import *


############################################################
############################################################

#Creating an array to hold data for plotting. See several
#lines below for more information

tempArray = []
pressureArray = []
altitudeArray = []

#The object that is created to interact with the Serial Port
arduinoSerialInput = serial.Serial('/dev/ttyACM0', 230400)

time.sleep(3)

#Here we set the definition oto look for interactive mode
#and plot live data
plt.ion()

############################################################
############################################################

clippingCounter = 0

#Here we define a function to make a plot, or figure of
#the data aquired

def plotTempData():

    plt.ylim(150,320)
    plt.title('Plots from data of the BMP Sensor')
    plt.grid(True)
    plt.ylabel('Tempature')
    plt.subplot(2, 2, 1)
    plt.plot(tempArray, 'ro-', label='Degrees K', linewidth=2)
    plt.legend(loc='upper left')

    #plt2 = plt.twinx()
    #plt2.plot(pressureArray, 'bx-')

def plotPresData():

    #plt.ylim(260,320)
    plt.title('Plots from data of the BMP Sensor')
    plt.grid(True)
    plt.ylabel('Pressure')
    plt.subplot(2, 2, 2)
    plt.plot(pressureArray, 'bo-', label='Pascals', linewidth=2)
    plt.legend(loc='upper left')
    plt.plot(pressureArray, 'bo-')
    plt.show()

############################################################
############################################################

while (1==1):
    #First things first, lets wait for data prior to reading
    if (arduinoSerialInput.inWaiting()>0):
        myArduinoData = arduinoSerialInput.readline()
#        print myArduinoData -Line commented out, see below

#The arduino should be set up to proovide one string of data
#from here we will seperate that one string into two or more
#to make it easier to plot

        #This will create an array seperated by the comma
        #we specified in the Arduino IDE aasign it to a
        #variable of our choice and convert the string
        #back into a number using the float command
        dataArray = myArduinoData.split(',')
        temp =  float(dataArray[0])
        pressure = float(dataArray[1])

        #Used to test the printing of values to output
        #print temp, " , ", pressure, " , ", altitude

#We need to create an array to to hold the values in question
#Looking at the top, you will see the empty array we need to
#create that will hold the values we need to plot
        tempArray.append(temp)
        pressureArray.append(pressure)

        plt.figure(1)
        drawnow(plotTempData)
        plt.pause(.000001)

        #plt.figure(2)
        drawnow(plotPresData)
        plt.pause(.000001)



#We want to clip some data off since the graph keeps
#expanding and too many points are building up.
        clippingCounter = clippingCounter + 1
        if(clippingCounter>50):
          tempArray.pop(0)
          pressureArray.pop(0)



############################################################
############################################################
8
  • ive found with arduino i usually need to sleep for a few seconds after opening the port (that may or may not actually be your issue) Commented Oct 21, 2016 at 17:03
  • Nope, that won't do it, but thanks. I imported time > import time , I then used the "time.sleep(3)" function directly below the arduinoSerialInput = serial.Serial('/dev/ttyACM0', 230400) command. Still nothing at the output shell Commented Oct 22, 2016 at 16:06
  • 1
    Have you tried running your code from the commandline - you might see the error then Commented Oct 22, 2016 at 16:26
  • Nice. I was able to find an error messege but I can't find any amenable Google searches to resolve it. The error messege is as follows: "Error retrieving accessibility bus address: or.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files" Commented Oct 23, 2016 at 7:22
  • I just upgraded to the new Pi3 and at the terminal window I ran the code as mentioned above. I get no error message now. I'm gunna try another OS besides Raspbian for now. Commented Oct 25, 2016 at 2:14

1 Answer 1

1

The error you mentioned is I believe an issue with 'at-spi2-core' module. The problem seems fixed on Ubuntu version 2.9.90-0ubuntu2, have you tried to upgrade the 'at-spi2-core' module? Alternatively forcing it to be enabled might solve your issue.

Information on ensuring the SPI is enabled is here : http://www.raspberrypi-spy.co.uk/2014/08/enabling-the-spi-interface-on-the-raspberry-pi/

Would have added this in a comment as I am not 100% on this but I don't have the rep for that.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your help, the recommendation does not work however. Btw, I am using Raspbian Jessie, not Ubuntu. I have enabled the SPI interface and now I get no error message at all when running in either the Python IDE or the terminal. The terminal just hangs now and doesn't report any error. Unfortunately, I don not know what to do.
Glad enabling SPI helped but sorry to hear you are still having issues. I mentioned the Ubuntu patch to show the problem is resolved upstream (albeit on a different distro), however it seems you have a different issue now anyway. Good luck, sorry I can't help further.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.