Go Down

Topic: Android Bluetooth joystick (Read 361266 times) previous topic - next topic

fullspool

Not quite  ;)
for 512 ADC counts, you get   73.982 * 512 -124755.859 = 86877 milliAmps
should be zero

The formula should give:
     0 Amp:            (2500mV)                                               1024/2 = 512 ADC counts
 100 Amps:           (2500 + (100*20) = 4500mV)           1024*(4500/5000) = 922 ADC counts
-100 Amps :          (2500 - (100*20) =  500mV)            1024*(500/5000)  = 102 ADC counts


Im not sure I fully understand on what the actual equation shall be. At 512 ADC my formula should read
milliAmp = 243.664 * analogRead(Apin) - 124755.859;    // (analogRead(Apin) * 4882.8125)/20 - 2500000/2

Then as amps increase (or decreases) it multiplies it by that variable ? Is this correct ?


what about my voltage telemetry formula? Did it appear to be correct? I can't test it until my resistors get here to confirm so I am only speculating.

kas

#736
Apr 07, 2016, 11:31 am Last Edit: Apr 07, 2016, 11:37 am by kas
Quote
Im not sure I fully understand on what the actual equation shall be. At 512 ADC my formula should read
milliAmp = 243.664 * analogRead(Apin) - 124755.859;    // (analogRead(Apin) * 4882.8125)/20 - 2500000/2

Then as amps increase (or decreases) it multiplies it by that variable ? Is this correct ?

what about my voltage telemetry formula? Did it appear to be correct? I can't test it until my resistors get here to confirm so I am only speculating.
Here are the formulae

Amp:
//   int mV = (analogRead(Apin) / 1024.0) * 5000;
//   milliAmp = ((mV - VSoffset) / MVperAMP) * 1000;
milliAmp = 244.14062 * analogRead(Apin) - 125000.0;       // (analogRead(Apin) * 4882.8125)/20 - 2500000/20

Volts:
using a 40k and 6k resistor for voltage divider :
voltage = analogRead(Vpin) * 0.037434895833;             // (5.0/1024.0)*((40+6)/6) = 0.037434895833 V per ADC count


Before connecting sensors to your Analog Inputs pins, check with your DVM
 -Amp sensor should supply 2500 mV when no current
 -voltage divider should output 3130mV for a 24.0V input




fullspool

#737
Apr 08, 2016, 05:20 am Last Edit: Apr 08, 2016, 05:26 am by fullspool
Here are the formulae

Amp:
//   int mV = (analogRead(Apin) / 1024.0) * 5000;
//   milliAmp = ((mV - VSoffset) / MVperAMP) * 1000;
milliAmp = 244.14062 * analogRead(Apin) - 125000.0;       // (analogRead(Apin) * 4882.8125)/20 - 2500000/20

Volts:
using a 40k and 6k resistor for voltage divider :
voltage = analogRead(Vpin) * 0.037434895833;             // (5.0/1024.0)*((40+6)/6) = 0.037434895833 V per ADC count


Before connecting sensors to your Analog Inputs pins, check with your DVM
 -Amp sensor should supply 2500 mV when no current
 -voltage divider should output 3130mV for a 24.0V input




I'm not sure where I messed up , let me study this more . Thank you for the help and I will test it further with my dmm.

fullspool

Before connecting sensors to your Analog Inputs pins, check with your DVM
 -Amp sensor should supply 2500 mV when no current
 -voltage divider should output 3130mV for a 24.0V input




Kas, for the amp sensor I am getting 1600mv with no current passing through the sensor.

woodygb

#739
Apr 10, 2016, 09:59 pm Last Edit: Apr 10, 2016, 10:03 pm by woodygb
The voltage.... as measured by your DVM .... that is being supplied to the Amp sensor is ?

fullspool

The voltage.... as measured by your DVM .... that is being supplied to the Amp sensor is ?
Measuring from ground and "OUT" on the amp sensor I get 1600mv , this is with no current flowing through the sensor.

woodygb

#741
Apr 11, 2016, 09:00 pm Last Edit: Apr 11, 2016, 09:14 pm by woodygb
That is not what I asked.
Quote
The voltage.... as measured by your DVM .... that is being supplied to the Amp sensor is ?
So ..is the INPUT voltage actually 5v  or is it perchance 3.3v ?

fullspool

That is not what I asked.
So ..is the INPUT voltage actually 5v  or is it perchance 3.3v ?
I am sorry, I misunderstood you. I was using a 5v power supply and it wasn't powerful enough so it was reading 3.6v input to amp sensor. I changed power supply and now I am getting 2590 mv from OUT to GND so everything is good. :)

rxget

Hello Kas,
I'm glad I found your software because of its user friendliness. However I have a small issue. I tried connecting a servo motor to it and added the following code:

 HorizontalServoPosition  = map(joyX, -99, 99, ServoH_Min , ServoH_Max);
 HorizontalServo.write(HorizontalServoPosition);

The servo does what it is supposed to do but it flickers continuously. Meaning it moves a little and comes back. Can you please suggest me a remedy? 

kas

Quote
The servo does what it is supposed to do but it flickers continuously. Meaning it moves a little and comes back. Can you please suggest me a remedy?
Hi rxget
 
Possibly a power supply problem
Please describe how you power both Arduino and servo


rxget

Hi rxget
 
Possibly a power supply problem
Please describe how you power both Arduino and servo


Well I tried different types of power supply methods. Mostly arduino and the servo have separate 5V power with common Ground trough a breadboard. I don't think its a power supply problem since I tried with a micro servo too and it does the same thing. I want to say that the flicker it's repetitive and constant as such the loop part of the code.   

kas

Please attach your Arduino sketch to your next post


Lila

Hello Kas,

I'm trying to replicate this project for an assignment in school. The goal it to make a remote controlled, two motor car. The original plan was to control the car with the gyroscope in my phone. I'm using an Arduino 101, Moto G 2, and an HC-06 bluetooth chip. I've wired the bluetooth chip to the arduino, downloaded your code onto the board and your app onto the phone, but cannot get the chip and phone to "connect." The phone has been able to pair with the chip, but whenever I try to connect from your app, the "connection fails." I have a limited understanding of how your code and bluetooth in general works. Do you have any ideas on what my problem could be?

woodygb

#748
Apr 28, 2016, 07:14 pm Last Edit: Apr 28, 2016, 07:19 pm by woodygb
Quote
is your Bluetooth card already configured @57600 bps  (most are 9600bps by default)
BT INO

kas

#749
Apr 29, 2016, 06:26 pm Last Edit: Apr 29, 2016, 06:30 pm by kas
Quote
is your Bluetooth card already configured @57600 bps  (most are 9600bps by default)
Woody, as far as I know, the Serial speed setting is not relevant for the radio link between Android device and BT card
It only applies to the serial link with the microcontroller
Actually, you can connect the card using any bps setting


@Lila
Create a clean test environment:
 - disconnect RX & TX from BT board, just keep 3.3V and Ground
 - reset the App (Preferences > reset Opt.)
 - restart App

Press Connect and make sure to choose the right BT board
The led should stop blinking
If unsure, try all devices in the list

EDIT: make sure it is not a Low Energy BT board
They look pretty much the same



Go Up