Great news, if you want I can also test. I have a wanscam IP camera (similar to foscam)
Great news, if you want I can also test. I have a wanscam IP camera (similar to foscam)
Why not
This a screen shot of "Total RC Commander" V0.1B:
The application is working but for the moment, the screen is optimized only for a 8" tablet
I suspect the application needs at least 7" to display the information correctly
sorry, no phones :~ :~
Do you have a tablet ??
Please let me have size and resolution
Wow, that was quick.
Yes I do have a tablet. Nexus 7 (2012) 7" 1280*800
Let me have your email via PM
PM sent
Check your mail
Hi, kas!
I am unable to implement your VERY COOL 8) app simply due to my inability to modify the Arduino sketch to meet my needs. I have little experience with microcontrollers, or in any programming in general, having started about 6 months ago with the Arduino, and have spent countless brain numbing hours since trying to understand basic sketch examples with little results. But I am very interested in figuring this out, as you mentioned in post #1, the possibilities are endless!
I have installed V.3.1 of your joystick app on my phone(samsung galaxy s3) and installed the v10.2 sketch from your post #99. I have the JY_MCU bluetooth module and everything seems to be communicating properly.
I wonder if you would consider my intentions, and provide some guidance on modifying the code/code snippets to ease me along?
My interest right now is simply to turn on and off three LEDs with the Android buttons(pressing Android button one turns on led1, press it again turns it off, same for button2 for led2 and button3 for led3) and drive one standard r/c servo both directions(CW, 0, CCW) using the joystick x axis. So far, I have been able to get some results with LEDs by using "digital.write" following several of the eight "case" statements, but for the most part the results are unreliable/unpredictable from what I expect. In viewing the serial monitor after my sketch modifications, I can not make sense of what is happening and why. I have not even attempted anything with the joystick, figured the LEDs would be easier first.
Many thanks for sharing your work, it is very nice!
I wonder if you would consider my intentions, and provide some guidance on modifying the code/code snippets to ease me along?
OK
First step
-
Which Arduino board are you using ?
-
download and run this sketch and confirm baurate + firmware version
// JY-MCU Bluetooth Dongle configurator
// Credit to Jeff Simpson
// Utility will display actual Baud rate and as an option,
// set up a new Baud rate
// TX BT board pin to Arduino D2
// RX BT board pin to Arduino D3
// 5V BT board pin to Arduino 5V
// GND BT board pin to Arduino GND
#include "SoftwareSerial.h"
SoftwareSerial mySerial(2, 3); // BlueTooth module TX RX
char response[21]; // responses from module
int rv = 0; // return value
boolean found = false; // module found
int bps;
void setup() {
Serial.begin(57600);
mySerial.begin(57600);
delay(300);
Serial.print("\n\nJY-MCU Bluetooth Dongle configurator ");
Serial.print("\nSearching "); // Search for BT module on 12 possible baudrates
long baud[12] = {1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1382400};
for(int a = 0; a < 12; a++)
{ mySerial.begin(baud[a]);
delay(300);
mySerial.write("AT"); // "AT" will respond with "OK" if it is working
delay(20);
mySerial.readBytes(response, 2);
delay(20);
if (strncmp(response, "OK", 2) == 0)
{ Serial.print("\nBluetooth Module found at BAUD ");
Serial.println(baud[a]);
found=true;
break;
} else Serial.print(".");
}
if (found==false)
{ Serial.println("\nERROR: Bluetooth Module not responding!");
Serial.println("Make sure there are no active bluetooth connection and try again");
while(1);
}
delay(100);
mySerial.write("AT+VERSION"); // Check the firmware version
while(mySerial.available() == 0);
mySerial.readBytes(response,2);
if (strncmp(response, "OK", 2)==0)
{ rv = mySerial.readBytes(response, 20);
response[rv] = 0;
Serial.print("Firmware Version: ");
Serial.println(response);
Serial.println();
} else {
Serial.println("Error checking BT Version");
Serial.println();
while(1);
}
while(Serial.available()) Serial.read();
Serial.println("To modify Baud rate, enter:");
Serial.println(" 1 for 1200 bps");
Serial.println(" 2 for 2400 bps");
Serial.println(" 3 for 4800 bps");
Serial.println(" 4 for 9600 bps");
Serial.println(" 5 for 19200 bps");
Serial.println(" 6 for 38400 bps");
Serial.println(" 7 for 57600 bps");
Serial.println(" 0 to Exit\n");
Serial.print("Selected: ");
while(Serial.available()==0);
bps = Serial.read();
if(bps>=48 & bps<=56) { // '0' < bps < '8'
Serial.println(bps-48);
if(bps>48) {
mySerial.write("AT+BAUD"); // Set the BAUD
mySerial.write(bps);
while(mySerial.available()==0);
mySerial.readBytes(response, 2);
if (strncmp(response, "OK", 2)==0) {
rv = mySerial.readBytes(response, 7);
response[rv] = 0;
Serial.print("New BAUD setting: ");
Serial.println(response);
} else {
Serial.println("Error Setting BAUD");
Serial.println(response);
}
Serial.println("Bluetooth Setup Completed ** End **");
while(1);
} else {
Serial.println("No modification ** End **");
while(1);
}
}
else Serial.println("non valid entry ** End **");
}
void loop() { }
Exit code by pressing "0"
- for the good sake, confirm that the JY_MCU led changes from blinking to solid red when connecting within Android BT Joystick
hello,
thanks kas for the help! ....If I could return the favor in any way...feel free to ask.
- breadboarded UNO
2)yes, I previously did the BT configuration. Baudrate is 57600, firmware is limnor(?) 1.8. I used the openpilot sketch for the configuration if you are familiar. - yes the JY-MCU red led goes solid upon connection, I definitely have BT comms working.
since my last post......I have had some success with the led portion. I am able to turn on and off one led with button1 using the following code snippets. However, the operation of the green button indicator lights on the phone eludes me. I would expect the indicator to stay on as long as the ledpin is on, however it just lights briefly after I press the button. I'm sure this is exactly as the code intends, But I don't understand which portion of the sketch controls this.
I tried blindly playing with this line with no idea what I was doing:
buttonStatus &= B0001;
including deleting it altogether, with no obvious affect on the operation. I can't figure out what action these lines in each of the case blocks perform .
this is the code I modified to some success. Is it reasonable?
int b1state=1
switch (buttonStatus) {
case '1':
buttonStatus &= B0001; // Button_1: ON
if (b1state==1){
Serial.println("Button_1: ON");
digitalWrite(ledPin, HIGH);}
if (b1state==0){
Serial.println("Button_1: OFF");
digitalWrite(ledPin,LOW);}
b1state= 1- b1state; // toggle led
break;
forgot to mention that I also had to comment out the lines following "case 2" or else it would immediately turn the ledpin back off.
edited for clarity
Hi billcat
I finally could reproduce the problem, my fault
Please download and run attached sketch (V10.3)
- button #1 controls on board LED (D13)
- button #2 controls debug mode (output to Serial Monitor)
- button #3 and #4 are just configured as push button (momentary contact)
Please let me know the outcome, especially for button #1
AndroLEDV10_3.ino (4.97 KB)
Hello kas,
Thanks for the updated sketch, I will try it out when I get a chance, but I wont be able to for a few days. I will let you know my outcome as soon as I can.
best wishes and thanks again for the cool app.
best wishes and thanks again for the cool app
Thanks billcat
Please let us have your feedback whenever you can
Great News
I got it working with this URL
http://IPaddress:port/videostream.cgi?user=admin&pwd=&resolution=32&rate=0Now, let me think out-loud some functionality questions if I may.
is it possible to increase the number of buttons ?
What data can the controller poll?
can I split it up and show for example
Battery=
Heading=
Lasers=
Mode=
Control=
e.t.cCan you increase the video size ?
Can you decrease the size of the joystick ? (to conserve space ?)
Can you add another option so instead of a joystick it shows 4 arrows to control the bot?
Is it possible to include toggle indicators ?
Sorry for all the loud thinking but I'm really exited with this. I was searching for something like this for a long time.
Thanks very much for all you hard work and sharing
OK
Previous design:
Proposed layout based on your comments:
- 640X480 video stream
- 1 joystick
- 6 buttons (latch or momentary)
- 4 robot parameter displays sent back from Arduino (voltage, heading, rpm, temp ...)
Actually I had to lower the resolution of the camera (320x240) because there was a terrible video lag of about 1 second or so
I don't get any lag with my Xperia Mini configured as an IP camera, check your camera settings, you may have to reduce fps value
Please let me have your comments
Thanks again for your suggestions and your positive feedback
Boy are you a coding machine. This is perfect.
Lets build on this and see how it works out.
Thanks a million
kas:
Please let me know the outcome, especially for button #1
Works perfect! Thanks for the fix, I am now able to do what I want with the leds I mentioned. Wish I understood the code fully so that I could modify as needed in the future.
Now I need to address the r/c servo scenario. I will try to figure it out myself first, but will probably end up needing advice on that later.
Cheers...
hi kas...again,
Sorry but I just now noticed your recent proposed "total rc commander", which looks :D. I had just been thinking it would be great if there were a few more buttons, and a way to send more data info.
Do you know if this version would work with my galaxy s3 and if so, is it also available on the google store?
Works perfect! Thanks for the fix, I am now able to do what I want with the leds I mentioned
@billcat
Glad it now works
@all
AndroLEDV10.2 introduced a nasty bug: buttonStatus was both declared as global and local
buttonStatus (global) was therefore never updated
Please discard V10.2 and download V10.3 (see reply #129)
Now I need to address the r/c servo scenario. I will try to figure it out myself first, but will probably end up needing advice on that later
Joystick Bluetooth Commander was specificaly developped for driving up to two r/c servo's. should you have any problem with the code, please ask
I just now noticed your recent proposed "total rc commander", which looks
![]()
:D. I had just been thinking it would be great if there were a few more buttons, and a way to send more data info.
Do you know if this version would work with my galaxy s3 and if so, is it also available on the google store?
Total RC Commander (with video stream display) is in development with tolisn63 support, now nearly ready
I invested quite a lot of time (and some money) in this project
My plan is to propose this application on Google Store for a couple of bucks, but I am concerned by Google privacy policy...
@all
Should you be interested by this App, please contact me via PM
This is looking better and better Kas, i belive you should go for the app,i am shore more than one would want a app like this,that can control a rc car toy with video ...with your phone.I am going to trie it soon,for the moment i am wayting the bluetooth JY MCU HC6 (hope its compatible)..
My ideea is to fit the Arduino and the JY-MCU with one servo for steering,one TB6612FNG motor driver,and cuple Leds,and a buzzer
If all this will work properly i will try out the camera funcion,so one again,im telling you,this app will have succes,you should look at how many visit this post had.Nice job..Thank you
This is looking better and better Kas, i belive you should go for the app,...
...,so one again,im telling you,this app will have succes,you should look at how many visit this post had.Nice job..Thank you
Thanks juycce for the kind word 8)
The App is ready, but rather demanding in term of processing power (bluetooth + wifi)
Together with tolisn63 we are busy optimising the code
@all
Any candidate as a second beta tester ??
required:
- high end tablet (google, Samsung...)
- a different IP camera (not Wanscam)
i just recived my JY-MCU V1.06 but i can't figure out how to pair it with the phone...I load the sketch (with the TX,RX pin disconected) search it with the phone pair it (1234) then open the app and it say Unable to connect device" , and Led wont get solid
I guess it is not compatible with the V1.06 ....any ideeas
..i tried all the codes you post..even that one that only control 2 servo ...thx