Show Posts
Pages: [1] 2 3 ... 27
1  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: September 11, 2014, 02:36:19 pm
Quote
There is an issue with the Delay (500) on halt  .... see if your button problems disappear if you make it Delay (10)
You are right, delay() create issues with Serial communication
RX buffer is probably overflowing and generating unpredictable errors

Thanks for bringing up this point  smiley-wink
2  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: September 11, 2014, 09:58:04 am
Hi janzluc14,

As woodygb mentioned, your project belongs to the ON/OFF world, no joystick required
You may look for another App that will better fit your needs

Quote
sir their are times that when i put the joystick on forward and backward....the buttons will turn on automatically..is it because of the program???
Possible communication errors  smiley-roll-blue smiley-roll-blue
I understand your BT card is now set @57600bps
Please confirm that the basic demo sketch is working OK

Also make sure that
 - Refresh Interval is set to 50ms
 -Timeout count is set to 10 intervals
3  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: September 07, 2014, 01:14:34 am
Quote
Hi Kas,

Yes ...I've used your Android App as the front end of a B.T. controlled wheelchair.
Thread here ...  http://www.wheelchairdriver.com/board/viewtopic.php?f=2&t=3790 ... the last few pages http://www.wheelchairdriver.com/board/viewtopic.php?f=2&t=3790&start=380are about the B.T.

Cheers Woody


Interesting   smiley-eek smiley-eek
Feel free to propose any App modification

I have worked with a british artist on this project
The robot was based on wheelchair motors, and fitted with proximity sonic sensors to avoid bumping on furniture/people

I also suggest using a simple "dead man" failsafe in your code, to stop the chair if BT signal is lost

4  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: September 06, 2014, 03:56:48 am
@tolisn63
Buttons #1 (auto), #2 (manual) and #3 (learn) should be exclusive and configured as "radio buttons"
Assuming "auto" is the default mode, this is the way to go:
Code:
void getButtonState(int bStatus)  {
  switch (bStatus) {
// -----------------  BUTTON #1  -----------
    case 'A':
      buttonStatus |= B000001;    
      buttonStatus &= B111001;      // <<<<   radio button
      displayStatus = "<Manual>";
      myServo_Mode.writeMicroseconds(1800);
      break;
    case 'B':
      buttonStatus &= B111110;
      buttonStatus |= B000010;
      displayStatus = "<Auto>";
      myServo_Mode.writeMicroseconds(1200);
      break;

// -----------------  BUTTON #2  ----------
    case 'C':
      buttonStatus |= B000010;
      buttonStatus &= B111010;
      displayStatus = "<Auto>";
      myServo_Mode.writeMicroseconds(1200);
      break;
    case 'D':
      // no action
      break;

// -----------------  BUTTON #3  ----------
    case 'E':
      buttonStatus |= B000100;
      buttonStatus &= B111100;
      displayStatus = "<Learning>";
      myServo_Mode.writeMicroseconds(1500);
      break;
    case 'F':
      buttonStatus &= B111011;
      buttonStatus |= B000010;
      displayStatus = "<Auto>";
      myServo_Mode.writeMicroseconds(1200);
      break;

// -----------------  BUTTON #4  -----------------------
    case 'G':
    ...............

feel free to change buttons order


@woodygb
Thanks for your help  smiley
Did you use BT Commander for a specific project ??
Let us have more info and photos
5  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 31, 2014, 02:04:36 am
Quote
i just want to say this is a good forum  smiley smiley

Thanks  smiley-cool
Welcome to the Arduino Forum
6  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 31, 2014, 12:57:10 am
Quote
... display battery charge indication ...
easy  smiley-wink
 - enable Arduino >> Android communication (see AndroTest V2.0 demo sketch)
 - bring a 4 Volts image of your battery level to Analog Input 0 using a resistive voltage divider
 - monitor A0 value every 1000ms
 - send value to datafield#1
 - if value < voltMin,  send  "** LOW Bat **"  message to datafield#3

Code:
void checkLowBat()  {                                            // check Low battery condition
  static long previousMillis = 0;                            
  long currentMillis = millis();
  if(currentMillis - previousMillis > checkLowBatInterval) {     // check every checkLowBatInterval milliseconds
    previousMillis = currentMillis;
    voltage = analogRead(Vpin) * K;                              // K: calculated according resistors values
    if(voltage < voltLimit)    displayStatus = "** LOW Bat **";  // send message to Android device
  }  
}
You can monitor both batteries, using A0 & A1



Quote
Other thoughts I had, could there be a WiFi version, would/could I also need a version of the app that includes video feedback ?
Should be possible
Total RC Commander is a sister App that includes Video features through WiFi

See the video in the Exhibition Section

Let me have more info about the video stream you want to display



Quote
Did you succeed in changing your BT card bps ??
The command line should be "at+uart=57600,0,0\r\n"

7  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 28, 2014, 09:03:47 am
Hi Vic,

Quote
Not sure what is happening here, does seem a power issue
Yes, highly probable
Check your ground connections as suggested by woodygb

Quote
When testing the setup using USB power, everything is fine
What is your actual USB 5V source ??   mAh available ??

Quote
So this led me to measure the voltages at each point and discovered the voltage drops to 4.03v
No drop when iddle ??
Is your battery pack brand new or used ??

According to Goteck GS-5515MG datasheet (4.8 & 6V):


2200mA at free run, means 5+ Amps at full load
This may be too much for a 2700mAh NiMH battery set
Try a 4000mAh+ battery pack

Any possibility to reduce required torque through better camera balance ??

8  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 27, 2014, 11:47:02 pm
Quote
Switching between modes is accomplished by changing pwm values on one channel. Thus when the pwm
value is "A" the apm mode is "manual", when it is "B" the mode goes to "Auto" and so on.
What are the specific values for A & B ??
Can you point me to the wiki part where this is described in details

The objective is to create a third PWM output
 If Button#1 == not pushed   then PWM = A  (manual mode, default)
 If Button#1 == pushed           then PWM = B  (autopilot mode)
Korrect ??
9  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 27, 2014, 11:25:48 am
Quote
The apm auto pilot accepts both pwm(default setting) and ppm signals(using a jumper to invoke the mode)
Beyond PWM data, what do you plan to send from BT Commander to APM  ??

How do you switch APM from autopilot to manual mode ??
Please post a link to the Operator's Manual
10  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 27, 2014, 04:18:35 am
Quote
Hi kas

Since the vacation season for me is nearly over I started to finish my custom made 4WD chassis using Dagu 75:1 motors and wheels.

The parts that I will use are:
1. USB RoboClaw 2x15A Brushed DC Motor Controller
2. APM2.6 autopilot      https://code.google.com/p/ardurover/wiki/ArduRover2Setup
3. An arduino (probably the mega2560)
4. 7.2V/8Ah NI-Mh battery
5. You application for setting the modes of the APM2.6, viewing the route using the IP camera and for manual controlling the rover.

Can you help me interface your application with the arduino and the APM2.6?
What I was thinking is have the application send command to the arduino and then the arduino send R/C compatible signals to the APM2.6 autopilot. The Autopilot will send control signal to the motor controller.

My goal is to have a waypoint following rover using the apm2.6 and also be able to control the rover in manual mode using your application.

let my hear your thoughts 


Hi tolisn63

Nice project   smiley-razz

Not too familiar with the ArduPilot Mega   smiley-roll-blue
I suspect APM2.6 accepts only PPM (Pulsed Position Modulation) combined signal
You will need a PWM to PPM converter such as this one (6$ shipped).
Conversion could be made directly by Arduino, but requires interrupts and signal timing may become an issue, depending on other connected sensors

Keep us aware
11  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 26, 2014, 03:44:57 am
from Google Play:
Quote
Awesome I use this great app to control my arduino-based tank. The developer seems very willing to provide a support and updates. For example he compiled a special version for me, when I was having some problems with the official release. Thanks
Jakub Topič

Thanks Jakub for this nice feedback, much appreciated   smiley
12  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 25, 2014, 11:06:02 am
Hi Vic,

Quote
Only works fully only if powered by USB for both servos and arduino, I have constructed a prototype shield which enables me to power them independently of each other, I can also jump power to servos form arduino uno power input (battery, USB).

If I power them independently, then the servos are erratic or go full 180 degs lock - not ideal as I wont have USB power in the field.
Have tried some similar ways of control of which independent power works ok - example here

I don't see any reason why the two App's would behave differently  smiley-sad-blue smiley-sad-blue
I would have expected better results with separate power, as USB is 5 Volts by nature and servo's need 6 Volts
Are your servo's Analog or digital ??   the solution is probably here

Finally, please post the sketches for the two controllers

13  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 07, 2014, 01:05:33 am
Your binary format printout explains it all:
  // Propeller joydata = (280 << 10) | 260  =  100  01100001  00000100  =  286980    
  // Arduino joydata   = (180 <<  8 ) | 160    =            10110100   10100000   =    46240

All methods are OK using Arduino _long_ integers (32 bits)

16 bit Arduino _unsigned_ integer does overflow when shifted 10 times
as 286980  >  65535 (2^16 -1)

even 16 bit Arduino _signed_ integer does overflow when shifted 8 times
as 46240  >  32767 (2^15 - 1)

Quote
I tried it again declaring joydata as an unsigned integer, and I got the same results I got in the above post
Still more room, this is luxury  smiley-wink
14  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 05, 2014, 12:06:21 pm
Quote
I revised the code that transfers the x & y data between cores (and it works).

I tried your code and got wrong results

Code:
unsigned int joyData;
int joyX, joyY;

void setup()  {
  Serial.begin(57600);
  
  // twm47099 code
  joyX = 280;    // 280-200 = 80
  joyY = 260;    // 260-200 = 60
  
  joyData = (joyX<<10) | joyY;                    // encoding
  // --------------------------------
  joyY = (joyData & 511) - 200;                   // decoding
  joyX = (joyData >> 10) - 200;
  Serial.print(joyX);  Serial.print("\t");  Serial.println(joyY);  Serial.println();
  // >> printed result:   -176 60  (not OK) <<


  
  // kas code
  joyX = 280;    // 280-200 = 80
  joyY = 260;    // 260-200 = 60

  joyData = (joyX-100 <<8) | joyY-100;              // encoding
  // --------------------------------
  joyX = (joyData >>8) -100;                        // decoding
  joyY = (joyData & 0xFF) -100;
  Serial.print(joyX);  Serial.print("\t");  Serial.print(joyY);
  // >> printed result:   80 60  (OK) <<
}

void loop()  {}

Probably due to data type implementation difference in Arduino and Propeller   smiley-roll-blue smiley-roll-blue
15  Using Arduino / Networking, Protocols, and Devices / Re: Android Bluetooth joystick on: August 04, 2014, 12:34:20 am
Quote
That was where I found a problem.  When transferring data between cores the Propeller automatically syncs the transfer for 1 variable.  For transferring groups of related data (x & y from the same time) the programmer has to handle it.  When the program printed x & y it was taking x & y from separate sequential data sets.  So I added a couple of global variables 'okwrite' and 'okread' to keep things sync'd.

I have no experience with multicore MCU's, so I may be wrong  smiley-roll-blue
What about combining  X & Y data into a single integer variable before transferring to the main core:
Code:
int joyData = joyX << 8  +  joyY
then parse back this value ??


Quote
One other thing, I haven't seen any button or joystick errors yet,
You may experience transmission errors when you start sending back data to the Android device
Pages: [1] 2 3 ... 27