I am using an Arduino Uno to sample a signal. I then want to send those samples in a block to the Raspberry Pi. At the moment I am simply using
(on the Arduino side) Within loop
(on the Raspberry Pi side, in python)
import Serial fromArd = serial.Serial('/dev/ttyACM0',9600) while True: try: val = ord(fromArd.read()) print(val)
This results in some values going missing (due to work queuing). Does anyone know how I can make sure the RasPi receives ALL the data it is sent?
I've used MPICH Message Passing Interface before but the Arduino doesn't have an OS, so I'm not sure how I can use it or if it would work.
Is there possibly another way of doing this by only sending data when the RasPi is willing to read it? Would this be interrupt driven or based on polling every time I want data to be sent?
Extra explanation: I know that some data was 'missed' or 'dropped' because the input to the Arduino was a sine wave and when I plot the results from the RaspberryPi there are phase changes in the sine wave. For example the values are slowly increasing then suddenly become zero and start to increase again. OR One cycle is measured as expected but the next cycle does not line up.
The RaspberryPi is not a real time device. My suspicion is that when I send data to it while it's doing other things (eg GPU) it doesn't read the data.
I looked at the data coming out of the Arduino when connected to my laptop - the wave form was exactly as expected so I think it is an issue with RasPi rather than Arduino.