Hi, I am trying to make an intel edison RC car, where the motor is powered by the intel edison board, and a joystick remote that is on another intel edison board, but i cannot seem to establish a bluetooth connection board to board, the best i got to so far was able to send strings by following the tutorial on this site:
http://stephaniemoyerman.com/?p=100 Edison to Edison Bluetooth | Musings from Stephanie
But i cant seem to make it work with the joystick, it looks something like this:
Is there anyway i can do it with arduino coding instead? as it is easier to control the motor with arduino. Long story short, i have a joystick connected to a intel edison board that im trying to send bluetooth signals of the joystick controls over to another intel edison board that is connected to a motor that controls a rc car. And i want to be able to establish a bluetooth connection where i can use the joystick to control the RC car.
PS. Both intel edison is connected to the arduino breakout board which looks like this
How exactly would you like to send the instructions? As I see it, the guide you followed would actually work great in your project since it uses SPP manually. That means that you could create a script in the Edison with the joystick that takes the devices inputs, translates them into string that are later sent through the rfcomm port to the other Edison. The second Edison would have to have a script that receives the strings sent by the first Edison and translate them back into signals that can be interpreted by the RC car.
I believe that using the Arduino IDE for this project is probably not the best approach since it would rely heavily on system calls that would complicate the project more than it has to. So, my suggestion would be that you stick to Linux for this project.
Thanks for taking your time to read and reply, i really do appreciate, I'm sorry i am not clear enough. The problem im facing currently is whenever i want to send something, i have to manually type it like that, is there a way where i can make it automated? Like how can i code it to automatically setup for me when i turn on the board. For example, when i turn on both boards, they will automatically open the rfcomm port and connect to each other, and afterwards, when i transmit the joystick data, the receiving end will continuously run ser.read(100); Sorry i am new at this and i have no idea how am i suppose to proceed, the string sending and receiving is as far as i got.
Thanks in advance!
I understand, you can easily achieve this by using bash scripts and system services. The bash script will send the commands automatically and the service will connect you automatically to the Bluetooth device. You could use a script similar to the following:
while [ $x -le 5 ]
echo "hello" > /dev/rfcomm0
x=$(( $x + 1 ))
Of course it must be modified to fit your project's needs. Also, to learn how to create a system service and how to connect to a Bluetooth device on boot, I'd suggest you to check:
Thank you for replying once again, now I seem to encounter another problem, when im trying to read my joystick input, i can only use arduino so far, is there a way i can read the input from python coding so i can use it in conjunction with my bluetooth coding? As i want to try reading the controller input and send the input via bluetooth to other edison board, and i have difficulty doing that.
You can't use mraa to read from /dev/rfcomm0, however you could use the library PySerial (http://pyserial.readthedocs.org/en/latest/shortintro.html http://pyserial.readthedocs.org/en/latest/shortintro.html) it is able to handle serial communications and it should let you interact with the input sent by the joystick.
Thanks for replying again, I have read through the link you've sent but i still have difficulty understanding which part of coding allows analog/digital input reading in python, thus i am unable to interact with the input from the joystick, could you kindly please provide an example of how i can read analog/digital input using pyserial? Thank you once again!
If I understood you correctly, in your previous posts you were explaining that when you connected the joystick to the Edison through Bluetooth you were receiving the inputs through /dev/rfcomm0. That's a virtual serial port, that's why I suggested you to use PySerial to read from it. But if what you'd like to do is to interact with digital/analog signals, then I'd suggest you to try using mraa. This library allows you to receive these kind of signals and output them as well.
Anyhow, I'm afraid I lost you. Could you explain me how you are going to receive and interpret the joystick signals?
Hi i have managed to established a connection and having the other side receiving my joystick data,
but now i am trying to used the received data to control a L298P motor using python but unable to find any code examples, was unable to find example to control that motor using python as well, do you have any advice on how i could do so?
The L298P is a H-bridge, in order to use it you will have to understand how they work. In that case I'd suggest you to read its datasheet (http://www.mouser.com/ds/2/389/CD00000240-224711.pdf http://www.mouser.com/ds/2/389/CD00000240-224711.pdf) and this very interesting article about the basics of H-bridges:
I hope this information is of help.
Thanks again for replying!! I manage to be able to code the motor except for 1 tiny issue, I am currently using the MRAA library and i have issue identifying which GPIO is which on the arduino breakout board that my intel edison is attached to, is there a table where i can declare the digital pins as GPIO is the MRAA?
There's not a table per se, since the configuration is very similar to the Arduino pinout, but that information can be found in https://github.com/intel-iot-devkit/mraa/blob/master/docs/edison.md https://github.com/intel-iot-devkit/mraa/blob/master/docs/edison.md.
I hope it help, let me know if otherwise.