Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Electrical (http://www.chiefdelphi.com/forums/forumdisplay.php?f=53)
-   -   Project Questions about Programming and Electrical (http://www.chiefdelphi.com/forums/showthread.php?t=58793)

RyanN 10-10-2007 15:38

Re: Project Questions about Programming and Electrical
 
I partially found the problem. My power relay's contacts were stuck closed because my connection pushed the contact up, but... that doesn't explain why it would turn off then after a few minutes, it would turn back on unless the copper connections were bending slightly after it cooled down.

Al Skierkiewicz 10-10-2007 15:45

Re: Project Questions about Programming and Electrical
 
Ryan,
When linking to your schematic the connection is refused so I can't be sure of what you are doing.
As to the power relay, did you solder directly to the relay contacts? Often this melts the base material and leaves enough slop in the contact to move around with heat/cool and vibration. Add to this a few errant metal shavings or whiskers and you end up with a contact that you can't really see but is there none the less. The best way to use realys is to add a socket. The socket is made for soldering and the relay merely plugs into it. Relays are notorious for acting weird especially on low current signals.

RyanN 10-10-2007 16:21

Re: Project Questions about Programming and Electrical
 
Quote:

Originally Posted by Al Skierkiewicz (Post 645602)
Ryan,
When linking to your schematic the connection is refused so I can't be sure of what you are doing.
As to the power relay, did you solder directly to the relay contacts? Often this melts the base material and leaves enough slop in the contact to move around with heat/cool and vibration. Add to this a few errant metal shavings or whiskers and you end up with a contact that you can't really see but is there none the less. The best way to use realys is to add a socket. The socket is made for soldering and the relay merely plugs into it. Relays are notorious for acting weird especially on low current signals.

I didn't solder it at all. I used female connections and it doesn't look melted at all. I think it may just be a defective connection. Here are the pictures I uploaded to facebook since my server doesn't want to cooperate:



Al Skierkiewicz 11-10-2007 07:40

Re: Project Questions about Programming and Electrical
 
Ryan,
Are you using the backup battery input to the RC? Since the relay outputs of the RC are intended for Spike connections, I am not sure what the actual signal output is. They may actually send a keep alive output which could turn the relay driver on. The Spike input circuit is pretty complex and has a lot of input filtering. I suspect that the RC is actually triggering the relay drive transistor. Also, the relay output only has to rise to 0.6 volts to turn the relay driver on in this configuration. You could simply try a 1k resistor in series with the base of the transistor and I would add a 0.1mfd cap base to emitter to quench any noise and see what happens.

RyanN 11-10-2007 21:14

Re: Project Questions about Programming and Electrical
 
Actually all seems to be working well just after replacing the relay. I got my charger connected and it seems to work perfectly. I only have the LEDs and sensors to connect now. I like how it is wrapping up and I hope to post some pictures of the spaghetti I have made into my project. TOO MANY SIGNAL WIRES!!!!! Oh well, as long as it doesn't break I'll be fine, and if it does, I just need to set aside a day to fix it :D. Thanks for all the help. If I encounter any trouble with the transistors, I will do what you said and add a resistor and a capacitor to the transistors. I actually found the Spike signal system to be very very simple. They output 5V (my personal favorite voltage for transistors and LEDs) It switches using IFI's seemingly favorite H bridge. If you put both fwd and rev to 1, then it outputs positive signals on the spike outputs, and they are both 0, then it's a negative signal. So what I've done is take like fwd and rev to turn individual spikes to only forward since accidentally reversing them will fry some things. Hopefully this all makes sense. If there are any questions for me, please don't hesitate to ask.

Al Skierkiewicz 12-10-2007 07:33

Re: Project Questions about Programming and Electrical
 
Glad you got it working the way you want. I love when that happens.

RyanN 12-10-2007 22:21

Re: Project Questions about Programming and Electrical
 
Quote:

Originally Posted by Phalanx (Post 642545)
Look in ifi_aliases.h, You will find the variables for the battery.
I hope this helps.

/*
*-----------------------------------------------------------------------------------------------------
*---------- Aliases for Battery Voltage bytes --------------------------------------------------------
*-----------------------------------------------------------------------------------------------------
* Formula to calculate voltage in volts:
* current_voltage = battery_voltage * 0.038 + 0.05;
*/

#define battery_voltage rxdata.rc_main_batt*15.64/256
#define backup_voltage rxdata.rc_backup_batt*15.64/256

I've gotten to the part of programming where I'm trying to get my charger working, but obviously there is something wrong with the code.
User_routines_fast.c
Code:

/*** DEFINE USER VARIABLES AND INITIALIZE THEM HERE ***/
int powerrelay;
int tempb;
int tempc;
int tempd;
int pwrofftmout;
int powerout;
int poweroutb;
int volts;
(Skip a lot of the stuff that doesn't matter in this post)
printf("volts %d\n","battery_voltage %d\n");
volts = battery_voltage*0.038+0.05; /*Should give the correct voltage*/

With my novice programming skills, all this seems good to me, however, when using the printf command (which I'm not sure I'm using it correctly) it says "volts 15865" meaning that it has no value for volts and when I manually convert: 15865*0.038+0.05 = 602.92V which is obviously not correct. Any help is greatly appreciated.

Also, the value 15865 does not change at all. It is constant when I disconnect the charger or when I put a load on the battery, which indicates something else is not working properly.

bear24rw 12-10-2007 22:45

Re: Project Questions about Programming and Electrical
 
Quote:

Originally Posted by RyanN (Post 645890)
I've gotten to the part of programming where I'm trying to get my charger working, but obviously there is something wrong with the code.
User_routines_fast.c
Code:

/*** DEFINE USER VARIABLES AND INITIALIZE THEM HERE ***/
int powerrelay;
int tempb;
int tempc;
int tempd;
int pwrofftmout;
int powerout;
int poweroutb;
int volts;
(Skip a lot of the stuff that doesn't matter in this post)
printf("volts %d\n","battery_voltage %d\n");
volts = battery_voltage*0.038+0.05; /*Should give the correct voltage*/

With my novice programming skills, all this seems good to me, however, when using the printf command (which I'm not sure I'm using it correctly) it says "volts 15865" meaning that it has no value for volts and when I manually convert: 15865*0.038+0.05 = 602.92V which is obviously not correct. Any help is greatly appreciated.

Also, the value 15865 does not change at all. It is constant when I disconnect the charger or when I put a load on the battery, which indicates something else is not working properly.

For your printF your not printing any values.. try it like this
Code:

printf("volts %d\n","battery_voltage %d\n",volts_variable, battery_voltage_variable);

RyanN 12-10-2007 22:58

Re: Project Questions about Programming and Electrical
 
Quote:

Originally Posted by bear24rw (Post 645893)
For your printF your not printing any values.. try it like this
Code:

printf("volts %d\n","battery_voltage %d\n",volts_variable, battery_voltage_variable);

The Code:
Code:

printf("volts %d\n","battery_voltage %d\n",volts_variable,battery_voltage_variable);
The Build:
Code:

C:\FrcCode2005v2.2\user_routines_fast.c:168:Error [1105] symbol 'volts_variable' has not been defined
C:\FrcCode2005v2.2\user_routines_fast.c:168:Error [1105] symbol 'battery_voltage_variable' has not been defined
C:\FrcCode2005v2.2\user_routines_fast.c:168:Warning [2058] call of function without prototype
Halting build on first failure as requested.

I also tried
Code:

printf("volts %d\n","battery_voltage %d\n",(int)volts,(int)battery_voltage);
That compiled, but it's still giving me a ridiculously high number, which is now constant at 16025.

bear24rw 13-10-2007 00:26

Re: Project Questions about Programming and Electrical
 
Are you doing the volts equation before printf?

bear24rw 13-10-2007 00:28

Re: Project Questions about Programming and Electrical
 
Code:

printf("volts %d\n","battery_voltage %d\n",(int)volts,(int)battery_voltage);
Try making that

Code:

printf("volts %d\n battery_voltage %d\n",(int)volts,(int)battery_voltage);

RyanN 14-10-2007 00:07

Re: Project Questions about Programming and Electrical
 
Well, I tried your code and same thing... I then defined battery_voltage in user_routines_fast and it's now updating, but the values are still in the 15 and 16000 range. I totally took out all the multiplication and stuff to get the normal volts and just created values using that equation so now I'm doing stuff like:
Code:

if (battery_voltage < 361)
{
relay02_fwd =  1 (<- this may be wrong, I'm writing this from memory)
}

The problem still remains: Why is my battery voltage appearing so high (like 600 volts)? I can't really see any relation. I may end up just making my own equation tomorrow or something that will allow me to get the voltage correct. Well, now I'm off to bed.

Edit: Just thought of another problem. My charger should stop charging when the value is greater than like 370 or something, but even though it's 16000, the charger remains on. I can connect the charger to a switch with the software and it works, so I'm probably screwing something up with the programming.

RyanN 21-10-2007 22:43

Re: Project Questions about Programming and Electrical
 
Well, no one has replied in over a week, so I'm going to ask again...
Okay... I've tried to program the controller to read the battery voltage, but it's giving me raw values of over 16,000 (if you go to this post, they're experiencing the same problem). No body answered their question, and I posted there yesterday and also got no answer. Please please, any ideas are greatly appreciated, otherwise this thing will overcharge as it did last time.


All times are GMT -5. The time now is 06:55.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi