SMALL - espritmodel.com SMALL - Telemetry SMALL - Radio
Reply
Thread Tools
Old Jan 11, 2011, 11:43 PM
sp5
Registered User
Joined Sep 2010
69 Posts
Idea
GPL Firmware for Bantam BC6 and clones

Over on the iMac B6 service menu thread, I've posted a firmware file I received for a no-name clone of the Bantam BC6 (that link explains that there are many identical clones of it, none of them nearly as high quality as the original)

Now we're working on a complete replacement firmware. This thread is for the discussion.
sp5 is offline Find More Posts by sp5
Last edited by sp5; Jan 14, 2011 at 12:50 PM.
Reply With Quote
Sign up now
to remove ads between posts
Old Jan 11, 2011, 11:47 PM
sp5
Registered User
Joined Sep 2010
69 Posts
If you'd like to get in on this action, you need an ISP (In-system programmer). You can get one of those here, but I recommend finding a much cheaper one. That's the official Atmel ISP adapter.

If you've ever re-flashed your radio, this is the same process.

Nysom posted a nice picture of the soldering he did for his mystery charger (no-name clone). He did a great job, so I've attached it here.
sp5 is offline Find More Posts by sp5
Last edited by sp5; Jan 12, 2011 at 02:39 PM.
Reply With Quote
Old Jan 12, 2011, 02:35 PM
sp5
Registered User
Joined Sep 2010
69 Posts
To get things started, here is the pinout of the ATMega32. You'll need to download the datasheet to identify where these pins are on your chip.

I'll edit this as I get more info, but there are a few pins I'm not sure about.

I haven't traced the filtering/dividing for measuring the balancer voltages on the '4051 analog mux so I don't know what every input is. There are only 6 balancer ports so there's one mystery pin in there - I don't know which one.

I don't have full information on the safety circuits (Q3, Q6, Q12, and D5) - still checking that part out. So please, please don't use this yet to replace your existing firmware.

Here's what I do know about the safety circuits and charging/discharging:
  • When idle:
    Set PORTA7=1, PORTD3=1, PORTD6=1
    Set OCR1B=0, OCR1A=0
  • When charging:
    Set PORTA7=?, PORTD3=?, PORTD6=?
    Set OCR1B=value 0-1FF (0-50%), OCR1A=0
  • When discharging:
    Set PORTA7=?, PORTD3=?, PORTD6=?
    Set OCR1B=1FF (50%), OCR1A=value 0-3FF (0-100%)

Colors:
Red = buttons, LCD, and speaker
Tan = balancer port
Green = charging and discharging circuits

PORTA
PORTA0 - in ADC0 - filtered, divided measurement of the battery + voltage
PORTA1 - in ADC1 - filtered, divided measurement of the battery - voltage
PORTA2 - in ADC2
PORTA3 - in ADC3
PORTA4 - in ADC4 - filtered, divided measurement of Vin
PORTA5 - out to Q15 (Q13-Q18 are the 6 pins of the balancer port)
PORTA6 - in ADC6 - COM from '4051 analog mux
8 analog inputs selected from ADC6 using PORTB5-7:
  1. balancer port measurement?
  2. balancer port measurement?
  3. balancer port measurement?
  4. balancer port measurement?
  5. balancer port measurement?
  6. balancer port measurement?
  7. balancer port measurement?
  8. temp sensor
PORTA7 - out to safety circuits (D5)
PORTB
PORTB0 - in inverted from button 0 (Batt Type) (0=pressed 1=not pressed)
PORTB1 - in inverted from button 1 (Dec) (0=pressed 1=not pressed)
PORTB2 - in inverted from button 2 (Inc) (0=pressed 1=not pressed)
PORTB3 - in inverted from button 3 (Enter) (0=pressed 1=not pressed)
PORTB4 - out to speaker
PORTB5-PORTB7 - out to '4051, tell it which of 8 inputs to read on ADC6
PORTC
PORTC0-PORTC3 - out to LCD, but pins reversed (HD44780 compatible, but only 4-bit mode. See here for a code sample, but keep reading this thread for comments on how to swap the 4 bits)
PORTC4 - out to LCD E pin (clock)
PORTC5 - out to LCD command/data pin
PORTC6 - out to Q13 (Q13-Q18 are the 6 pins of the balancer port)
PORTC7 - out to Q14 (Q13-Q18 are the 6 pins of the balancer port)
PORTD
PORTD0 - out to Q16 (Q13-Q18 are the 6 pins of the balancer port)
PORTD1 - USART out to TXD pin for PC link
PORTD2 - out to Q17 (Q13-Q18 are the 6 pins of the balancer port)
PORTD3 - out to safety circuits (Q12)
PORTD4 - out 10-bit PWM OC1B - set power supply voltage for charging
PORTD5 - out 10-bit PWM OC1A - set voltage for discharging
PORTD6 - out to safety circuits (Q6, Q3)
PORTD7 - out to Q18 (Q13-Q18 are the 6 pins of the balancer port)

The crystal for the system clock runs at 16 MHz (F_CPU = 16000000). Although you might find it useful to use more, only two interrupt vectors are absolutely necessary: one for a timer interrupt; and one for ADC_READY. The ADC is not configured in free-running mode because the input is switched after each conversion. But the ADC inputs are read constantly.

(Some reverse-engineered schematics are over here but they don't seem to show the ATMega32. Anyone with more info, please hit reply.)
sp5 is offline Find More Posts by sp5
Last edited by sp5; Oct 29, 2011 at 10:37 PM.
Reply With Quote
Old Jan 12, 2011, 03:33 PM
ProgressiveRC
write2dgray's Avatar
Seattle, WA
Joined Dec 2006
1,997 Posts
Interesting project - I'll stay tuned in and offer something down the road if/when I can.

- David
write2dgray is offline Find More Posts by write2dgray
RCG Plus Member
Reply With Quote
Old Jan 12, 2011, 04:42 PM
Registered User
MoFl's Avatar
Espaņa, AL, Sevilla
Joined Apr 2007
515 Posts
Quote:
Originally Posted by sp5 View Post
...(Some reverse-engineered schematics are over here but they don't seem to show the ATMega32. Anyone with more info, please hit reply.)
The ATMega32 isn't shown, but I understand it's pin numbers are referred in the labels; for example, in the attached image (from one of those schematics) "34(ADC3)" would mean this point is connected to pin 32 of the MCU, which is configured as input for ADC#3
MoFl is offline Find More Posts by MoFl
Reply With Quote
Old Jan 15, 2011, 05:06 PM
Registered User
Joined Nov 2010
14 Posts
If I knew you were going to write the firmware from scratch? You crazy? No normal person would not do that because
1. This requires knowledge of the best / safest way to charge different batteries.
2. Controller programming skills mega32 or similar
3. Enormous amount of time
4. You do not explode a li-ion battery before the finish.

I have experience in programming such controllers and I declare this madness, especially since all works fine.

And to finish the code can, for example, the code that will use the charger as a power supply.

For example, to the inclusion of press time inc and dec, turn on the charger and switched mode power supply
But you need to:
1. A place where you can take control (one of the easiest stages)
2. Find an existing piece of code responsible for the information output on the screen. (I have not yet succeeded)
3. Find in the scheme of how the controller measures the current voltage and adjusts the tension. (Very easy)
4. Find the program as the controller measures the voltage and current (including the use of calibration data) (very difficult)
5. Write code that will do all that is needed (intermediate)

If there are enough people can make aforesaid or part of it, I would participate.
tolyan23 is offline Find More Posts by tolyan23
Reply With Quote
Old Jan 15, 2011, 07:20 PM
sp5
Registered User
Joined Sep 2010
69 Posts
tolyan23, please start your own thread to discuss modifications to existing firmware which you do not have rights to make derivative works from.

I will not respond to your posts on this thread.
sp5 is offline Find More Posts by sp5
Reply With Quote
Old Jan 16, 2011, 09:31 AM
Registered User
Joined Nov 2010
14 Posts
1. I paid for the hardware and software (most likely only for hardware judging by the price and not protected by the firmware, but it is on the conscience of the manufacturer).
2. I HAVE the RIGHT to make ANY modification on the fact that I have.
Since not nanoshu no direct or indirect damage to the manufacturer and the copyright holder.
I understand your position. I will not do anything. The desire to do it alone no.

May I ask? You yourself ever writing a program for the microcontroller?
tolyan23 is offline Find More Posts by tolyan23
Reply With Quote
Old Jan 16, 2011, 12:27 PM
Registered User
SteveM732's Avatar
United States, OR, Beaverton
Joined Feb 2008
1,976 Posts
Wouldn't it be easier, safer, and cheaper in the long run to toss the $40 charger into the trash and move on with life, lesson learned?

I've seen AVR ISP dongles for serial and parallel ports that can be made for less than $1 or even using items that one might have on hand, but the average Joe is going to need to buy an ISP and I believe some of the cheaper ones start at $15. So by the time you solder wires to the ISP pins, buy a programmer, and install homebrew firmware have you really saved any money or gained yourself anything?
SteveM732 is offline Find More Posts by SteveM732
Reply With Quote
Old Jan 16, 2011, 01:52 PM
Registered User
MoFl's Avatar
Espaņa, AL, Sevilla
Joined Apr 2007
515 Posts
Quote:
Originally Posted by SteveM732 View Post
Wouldn't it be easier, safer, and cheaper in the long run to toss the $40 charger into the trash and move on with life, lesson learned?
Probably it would, but you'd loose the fun . Most of the time, DIY isn't for saving money, but learning and having fun.

And, sometimes, it leads to a very improved product, as is happening with the FS-TH9X custom FW.
MoFl is offline Find More Posts by MoFl
Reply With Quote
Old Jan 16, 2011, 02:45 PM
Registered User
SteveM732's Avatar
United States, OR, Beaverton
Joined Feb 2008
1,976 Posts
Quote:
Originally Posted by MoFl View Post
Probably it would, but you'd loose the fun . Most of the time, DIY isn't for saving money, but learning and having fun.

And, sometimes, it leads to a very improved product, as is happening with the FS-TH9X custom FW.
Without a doubt it can be fun and educational, especially with an AVR due to the wide and open tool support like gcc, avrlibc, and avrdude. But even with those benefits I can't help but think that you can't make a silk purse out of a sow's ear so why try to fix the iMax? If the Bantam firmware had some issues that they weren't fixing then I could see a reason to try to roll firmware for the BC6.
SteveM732 is offline Find More Posts by SteveM732
Reply With Quote
Old Jan 17, 2011, 12:55 AM
sp5
Registered User
Joined Sep 2010
69 Posts
Quote:
Originally Posted by SteveM732 View Post
Wouldn't it be easier, safer, and cheaper in the long run to toss the $40 charger into the trash and move on with life, lesson learned?
You're absolutely right that it is cheaper to just buy the right charger. I've told people to get an iCharger - you can download new firmware for it from them.

This type of charger is so common, and it has so many problems, that there will be a lot of people who want to "fix" it.

Since I lucked out and received one that was unprotected, I went ahead and reverse-engineered the firmware. Since posting, I've been handed the schematics. For me, it seems like it's just waiting to be done. All the pieces are in place.

Personally, I like going out of my way to make do with what I have. But I will try as much as I can to warn people away from these bad chargers.

Who knows what will happen?
sp5 is offline Find More Posts by sp5
Reply With Quote
Old Jan 17, 2011, 03:15 AM
Registered User
SteveM732's Avatar
United States, OR, Beaverton
Joined Feb 2008
1,976 Posts
Quote:
Originally Posted by sp5 View Post
Since I lucked out and received one that was unprotected, I went ahead and reverse-engineered the firmware. Since posting, I've been handed the schematics. For me, it seems like it's just waiting to be done. All the pieces are in place.
Hmmm, so you were able to get access to the binary and de-compiled it? Just having access to the binary isn't reverse engineering per se, but it would allow minor tweaking without a need for access to the source or a compiler.

So who is going to start over from scratch to create GPL firmware and how hard is it to support the various clones?
SteveM732 is offline Find More Posts by SteveM732
Reply With Quote
Old Jan 17, 2011, 06:53 AM
Registered User
MoFl's Avatar
Espaņa, AL, Sevilla
Joined Apr 2007
515 Posts
Quote:
Originally Posted by SteveM732 View Post
Just having access to the binary isn't reverse engineering per se, but it would allow minor tweaking without a need for access to the source or a compiler
One of this minor tweaks (unlocking the balancer calibration menu) has already been done in the other thread (for example, posts 111 and 125).

Quote:
Originally Posted by SteveM732 View Post
... how hard is it to support the various clones?
SP5 checked that the FW for Imax B& and Mystery clone were practically the same.

According to AlexN's opinion (the guy who reverse engineered the schematic of the RC-Power B6 charger), this charger would be essentially the same as Imax B6, Turnigy Accucel-6, GT Power A-6, Mystery B6.

My theory is one of the manufacturers (Bantam?) developed the first model, and the rest of them just cloned it (FW included, with minor -e.g. splash message- alterations), so the main differences among them would only be the quality of components (worse spec MOSFETS, non-precision resistors in the voltage dividers...). If this theory was true, the FW would be valid for most of them.
MoFl is offline Find More Posts by MoFl
Reply With Quote
Old Jan 17, 2011, 10:16 AM
Registered User
Joined Nov 2010
14 Posts
I did not realize you're going to write the program again, or modify what is? What's not to like in the original?
I am a little confused after the calibration is not reload. And a bit annoying that the navigation of the main menu by pressing the buttons to "stop" and "inc" instead inc and dec. But it's those little things that fix them even have time sorry
tolyan23 is offline Find More Posts by tolyan23
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Sold Bantam E-Station BC6 Dual power charger garrcass Aircraft - Electric - Batteries & Chargers (FS/W) 5 Feb 19, 2011 01:25 AM
Help! RESOLVED: E-Station Bantam BC6 Dual Power Won't Turn On??? lafuerza Batteries and Chargers 10 Nov 15, 2010 01:33 PM
Sold Like New Bantam E-Station BC6 For Sale Craig9080 Aircraft - Electric - Batteries & Chargers (FS/W) 1 Jul 21, 2009 06:48 PM
For Sale Bantam e-Station EAC144 for Align / Dualksy BC-6/BC6-10 & PB-6 sa-woody Aircraft - Electric - Batteries & Chargers (FS/W) 4 Feb 09, 2009 12:10 PM
For Sale For Sale - Brand New Bantam E-station BC6 AC/DC Balancing Charger helitaiwan963 Aircraft - Electric - Batteries & Chargers (FS/W) 3 Aug 16, 2008 06:33 PM