[Q] Robot with dual batteries and relay for 2nd battery

CrossRoads:
Yeah, I see you have the pcb layout there. Still, looks very nice :slight_smile:

LOL, thanks. :slight_smile:

Updated image

I tired a LED and it does turn off and on. Using the same pin 51.

Ok , the way you show the swithch can't be how you have it wired, nothing would be powered.
Are you sure its not more like this?

Which motor controller is it? I can't find it in the thread.

Here is the motor controller

You are right about the switch, I didn't use it correctly in the diagram. I will fix it.

Thanks.

Got some problems here:

The controller uses a 16 MHz ATmega168 - data sheet says it needs ~3.9V to run at 16 MHz, below that operation may become unstable (altho folks have reported good operation down a 3.3V).
If you bring in Vbatt thru JP12 or JP13, it goes thru a regulator. You may have better luck with good comms bringing Vbatt on on one of the 5V pins on a different connector.

The L298 spec says it needs the motor supply voltage Vs to be the minimum Vin-high voltagte of 2.3V plus another 2.5V - so 4.8V. So, 3.7-4.2V would seem to be a problem.

Oops I forgot to include the step-ups in the diagram... sorry.

What are the step ups? How much current are they rated for?

CrossRoads:
What are the step ups? How much current are they rated for?

DC to DC Module based on LM2587 Step-Up (Boost) Regulator

Non-Isolated Steip-Up Module

Input Voltage : DC 3-24V

Input Current : 5Amp (Max)

Output Voltage : DC 4-30v

Output Current : Rated 3A ( peak 5A)

Output Power : 30watt without Heat Sink

35watt with Heat Sink

Output ripple : 20M bandwidth (for reference only)

Operating temperature : Industrial grade (-40 to +85)

Full load temperature rise : 45

Load Regulation : ± 0.5%

Voltage regulation rate : ±0.5%

Dynamic response speed:5% 200uS

Dimensions: Length (3.8 ) * width ( 5.2) * high (2.0) (CM)

Note: There is no Short circuit protection & no Input reverse polarity protection.

Seems like you'd have plenty of incoming power available.

I recall seeing someplace that the controller LEDs were turning on?

The data sheet says:
"If an invalid character or an invalid message is entered, the device will echo an error response back on the serial
interface and no changes will be made to the motors speed or direction."

Can you connect the controller's Tx line to your MEG2560 and see if you are getting anything back?

Are these LEDs turning on:

"Also if an over-current event is detected one of the two LEDs will turn on until the condition is resolved.
Stat 1 LED will turn on if M1 is in over-current, Stat 2 will turn on if M2 is in the over-current state."

I updated the schematic.

If the Arduino is powered an not sending commands and I have the TX/RX connected,(the MC is off) the Power LED on the MC will turn on but not as bright as when it is powered by the battery. This happens if at least the ground is connected to the MC. I can also measure some voltage coming from the step-up.

Most of the time the MC will only be off for a second unless it is shutdown to decrease charging time.

Neither STAT LEDs come on or have been on.

I don't know I am almost thinking now with the DPDT switch that I should skip the relay, but at the same time I want to figure it out as a learning experience and I think this is a good feature/option/just in case to have on the robot.

On a side note, I am thinking once I get everything working and designed that I would create a custom PCB that has everything on 1 PCB. Except for the Arduino, shields and motor controller. I think it would be more efficient and take less room, possible use less battery as well.

"If the Arduino is powered an not sending commands and I have the TX/RX connected the Power LED on the MC will turn on but not as bright as when it is powered by the battery. This happens if at least the ground is connected to the MC."

Ok, that part is certainly possible if the Mega2560 line are sitting at high levels - there could be leakage thru the internal circuiry that shows up on the Atmega168 5V line and turns on the power LED which is connected to 5V as well.
You are not supposed to apply highs on the I/O lines without power being applied, is bad for the part.
If the mega2560 is powered, the MC should be powered at the same time.

Re: PCB - if you are not using all the mega2560 capacity, you could probably reduce all this to a couple of atmega328s, an L298, and the battery charger chip on a PCB. (and the crystals and caps and screw blocks/or similar for the battery & motor connections.)

I noticed that it doesn't happen until the Arduino is fully booted, which is I think when it initializes the Serial2 as active in my code.

So I should skip the relay and maybe software limit how fast the motors can go without making the battery cut out. I asume when its idle it isn't drawing much, I do hear a buzz from the motors when its powered though. Shouldn't affect charging time/rate much.

I am starting to use a lot more of the Mega2560. Both in code space and GPIO's.

I will add the rest to the schematic this week.

Here is a ruff list

Camera Power Control
Power control of 5v Regulator (for sensors/servos/Xbee/WiFi, that way it doesn't overload the Arduino built-in regulator)
LCD TX (LCD has a Arduino Controlled backpack)
2 IR Distance Sensors
1 UltraSonic
2 IR Distance Switches
Voice Shield
Xbee/WiFi
Current Sensor
2 Battery Levels Sensors (Voltage Divider)
Audio Sensor
2 Servos (Camera Pan/Tilt)
Motor Controller > 4 Motors

Haven't added
2 Charging Stats Sensors (Voltage Dividers connected to charge LED's on the chargers)
LED Headlights (not need since camera has IR, but good for looks)

Everything is mounted on this platform

I think that is it.

Either way I want to see this relay work from a Arduino Pin. I think tomorrow I will try it with my Arduino UNO and see if I can't get it to work with basic code and nothing else connected.

Is it possible just the motors stopping which take the load off is enough to reset the protection circuit on the battery.

I think I will sleep on it and try the robot without the relay and do some testing tomorrow.

Thanks again. I will posting progress on my blog. I posted today and should be posting soon about this robot.