I need some input to solve an issue with my EV conversion

Thank you. Since this is an electric vehicle i would only be shifting gears when changing from city(stop&go) to highway driving. In all likelyhood I will only be using 2nd and 5th gear, but I would like to retain the ability to use any gear I want. So what I was thinking was a 8 position rotary switch or perhaps separate switches that could be switched on to go to a different gear. would the input to go to a different position just be a voltage between 0-5V?? If the encoder(??) is not needed to just change gears manually, that’s even better. It just needs to be very simple. When I get in the car I would put it in whatever gear I choose, and it would pretty much stay there. Forward or reverse is controlled by the Curtis 1238-7601 650 Amp controller(@108V). I did get a Arduino Mega 2560 board from my daughter for Xmas, but if you have what I need I will go with that and use the Arduino on a future project.
Could the MX-04 Servo driver be used as gear position input along with the SyRen 10 motorcontroller?? If it could, I could machine slots in the knob at the correct positions with a locking mechanism to prevent unwanted shifts. In the picture you can see the top of the gear selector drum. it is currently in second gear. the range of motion is from R to 6 so about 350 degrees


I appreciate your help, and am anxious to order once I know exactly what i will need.
thank you

Here are 2 more pics the first picture shows the complete mechanism with the motor shaft on the right.

The second shows the shiftermotor and the pot on the gearbox with the C-35 electric Motor attached in the back. i hope this helps make it clearer.

thank you for your time
Andre

The servo driver will not help here. There is no way to set the positions accurately and machining slots would be extremely difficult to set up to get the desired results.

There is no reason you need to use the Basic Atom Pro if you have the Arduino Mega. I know enough programming to get by with the basic language the Atom uses, but I have no experience with Arduino C. Do you have any programming experience?

The first thing I would do is connect 5vdc and ground to the two ends of the pot, and measure the voltage off the wiper when it is in each of the gears and write these numbers down. The Arduino board should be a good source for the 5vdc. Note this has to be regulated because if it’s not then the voltages will not be repeatable.

I would probably choose the RC input for the SyRen just because I’m familiar with it. Then maybe write a program to move it back and forth from two positions until it is reliable.

I will attempt to illustrate what the program would look like.

Thank you, Jim, No I do not have any programming experience which is why I am looking to something simple like the Servo driver. I am very good at metal fabricating and wiring, both AC and DC, and have a very good understanding of how electric circuits work but that ends when I get to PCB’s and IC’s.
So that’s where I will be needing the advice. I guess what would be important is that the gears could be changed very easily with a switch or something and not something where a laptop would be needed
to change gears, so if for instance my wife wants to use the car it would be simple to change gears for her. I understand that the position the servo goes to is determined by the pulse width of the signal the motor controller receives. the Atom pro would generate that signal, I assume based on the programming. If the signals for each gear position can be activated by a switch or several switches that would work for me
Thank you
Andre

Ok then. Yes it is certainly doable. The BotBoard II with Atom Pro is a microcontroller. It needs to be connected to a PC for programming only. Once it is programmed it is disconnected from the PC and it runs on it’s own. Yes all that will be required is the press of a switch to shift.

I can try to help you, but understand I will not be able to do it for you. I am not a great programmer. If you want to learn it’s not terribly difficult. If you have a logical mind or are good at solving abstract problems you might even enjoy it.

It’s funny seeing the big electric motor where the ICE used to be. Curious, do you know what the equivalent gear reductions are for the speeds? Wondering how much resistance the gearbox has. Interesting project!

So I would start by connecting the pot to the analog input. Then write a program to read the sensor, then send the value to the PC so you can see what it is. It will change as the pot is moved. These values would be important when you start moving the motor / pot.

var pot_position word '<- sets up the variable for storing the pot value. loop: '<- label, you can "goto" here. adin 0, pot_position '<- the variable pot_position now holds the numeric value of the pots position. serout s_out,i9600,"Analog input reading:",dec pot_value,13] '<- this sends the value to the PC so you can see it. pause 100 '<- a small 0.1 second pause, no need to go full speed here. goto loop '<- this makes it do the routine in a never ending loop.

When the values are defined the next step would be to rotate the motor. Then close the loop to make it operate as a servo, then finally add the inputs. Any interest?

Wow, I had to go do something for a while and I just came back to find all this great stuff.Excellent.
Thank you Jim. help is wonderful I am very logical and love solving problems like doing a EV conversion, and that’s exactly what this whole process of making this gearbox work has been about, when most everybody else is telling me there is noway except with the original ECU. I have been working on solving this for about a month now, and when I started I knew nothing about servos, controllers and drivers, I also now know everything about that gearbox, and found a neat website all about robotics that has sparked my interest for something in the future.
Yes I am very Interested in fact, please make me a list of the items I will need so I can order these
right away. It will take a couple of weeks before I get them here in ARUBA. In the meantime I can download the manuals and start reading up on writing code. I had already measured voltages from the pot, but I see already that I will be able to read them exactly to my PC from the pot, so best to wait till I get the stuff. You asked about the gearbox ratios. It’s actually a pretty neat gearbox. It’s has six forward gear ratios, but is in fact only a 3 ratio gearbox combined with a 2 ratio differential in one unit. So you shift 1,2,3 in the first final ratio, and 1,2,3 again in the second final ratio to get 4,5,6. Here is a link to the gear ratio charts. it’s the first column in the top table.
evilution.co.uk/304 It’s low on friction, and I have also removed the reversing gear, and will use synthetic transmission fluid instead of gear oil to reduce it even more. here are 2 more pics for your enjoyment.


I want to state that this could be done for less money, but would require a much steeper learning curve. These components are pretty easy to work with.

You will need the following components.

lynxmotion.com/p-252-bot-board-ii.aspx
lynxmotion.com/p-468-basic-a … 8-pin.aspx
lynxmotion.com/p-564-syren-1 … oller.aspx

You may need this.
lynxmotion.com/p-699-usb-to- … cable.aspx

So no reverse gear cause the motor is reversible. You will only need to switch from high and low ratios. Do you need to be able to set to neutral as well?

A 35 hp three phase AC motor being driven by nine batterys sounds interesting. How does that work? Also, does the transmission have clutches to take the load off of the gearing when a shift occurrs?

Alright, I just placed my order, so now I will wait patiently and read up on writing code. Any good sources about code I should checkout???
Thank you for the shopping list Jim. That’s right, the motor is reversible so I chucked the reversing gear. It was just a small idler that canged the output shaft direction. If I could just shift the low to high ratio alone that would the best solution. Unfortunately the shifting mechanism won’t allow that and I want to be able to use all the gears anyway.

This is an AC motor kit that uses a high performance Golf Cart motor. The Curtis controller converts the 108 V DC (9x12 V in series 100 Ahr deep cycle AGM batteries) to 3 phase AC, and also has regenerative braking. thunderstruck-ev.com/ac-35.html They predict 75 mph top speed,
50+ km range, and that it should leave most cars in the dust when the traffic light turns green.
The car used to have a clutch, but I left it out because I would have had to place the motor a few inches further from the gearbox to acomodate it and then the whole deal would not have fit anymore. So I will only change gears when stopped in order to go from city driving to highway driving. The speed limit in Aruba is only 50 mph so it should not be a problem. I will post how that works out when I get to that stage. I will post updates, and I appreciate the advise

Hi all, I’m back again. I received my parts from Lynxmotion, and all I can say is that it was probably the neatest method of protecting the contents of a package I have ever received. It was almost too pretty to cut open. So, after I unpacked the items I started playing around with my new toys.
anyway to get straight to the point, I had good results, and bad results. First the bad. I was playing with the Syren motor controller using a pot to make the motor change directions and stop. Well, even with Red and Black wires and clamps I still managed to hook up the wires backwards and that was it for the controller. I already have a new one on the way, and this time I will be using plugs to hook up the power. The good results were that i figured out how to load programs on the Bot Board/Atom Pro, and get them to run. I loaded the code you wrote for me to get the positions for the different gears from the Pot. At first it told me there were errors in the program, so I went over it and noticed that the variable name in the output line was different. after I changed it the program worked fine. Hey Jim, did you put that glitch in there on purpose to see if I could figure it out?? Anyway, The gear positions from the Pot are
Reverse 973
Neutral 897
1st gear 817
2nd gear 697
3d gear 544
4th gear 347
5thh gear 224
6th gear 62
The way I picture this working is that the Gear position sensor Pot from the gearbox goes to an analog input on the bot Board. when a different gear is selected the program compares the current position to the selected one and reads an error. Depending on whether it’s a positive or negative error the program sends a pulsed signal to the S1 terminal of the Syren telling it which way to spin the motor, and to stop the motor when the error is 0. That’s a very basic explanation, and I hope it’s kind of correct. If not then please correct me, and get me started in the right direction to write a program. Oh, Is it possible to have the controller I messed up repaired??

Basic proportional ‘P’ control system. Could also implement a derivative ‘D’ component, it would converge better (PD).

Alan KM6VV

Hi Andre,

Except for the reverse voltage thing… you really did great! No, not on purpose. It was an honest mistake, so you really did a good job! And you are right on the money as to how to control the gear selection. Can you rotate the motor/pot continuously? I’m working on your next test program. There is little hope of repairing a board that had the voltage reversed.

Hi guys, thanks for getting back to me. Alan, I looked up Proportional controls, and that helped me in understanding what is going to be happening when the shift selector gear is approaching a new setpoint(gear position). I believe the problem with overshooting the setpoint will be minimal because each gear position on selector gear has a Dimple that a ball with a heavy duty spring behind it drops into(a ball detent). You can see the dimples in the pictures I previously posted. This is the exact position for each gear and that is where the pot positions were taken. So once the spring forces the ball into the detent dimple it should go right to the new setpoint.
Jim, I did not try the controller on the actual shifter motor. I made a test setup to play around with, using a 10K pot to control the motor speed and direction. I had planned to try it on the real motor but fried the controller showing my son how it worked on the test bench the night before.


I have been going thru the reference manual, and I’m thinking that you will probably be using the
IF, THEN, and <, > commands in the next code. It’s very late so I will do more research tomorrow
I have to share with you that since starting my change over to Renewable Energy 2 years ago I finally today received a bill from the Electric Co. for 0.00 This is a big milestone for me, and is way beyond what I had expected to be able to do in terms of using green energy without changing my lifestyle. This EV conversion is my next phase in my “Go Green” plan.
Thanks for your helping me to go greener.

Good morning, I have spent many hours going thru the reference manual for Basic Micro Studio, and I am sure you realize that being new to this I am probably more confused instead of being more enlightened. This is mostly because the examples in the reference manual are very vague with the exception of the Adin command that was actually quite to the point, and that’s why I got the code example Jim gave to work, The only part I will take credit for is that I took the time to read up on all the stuff that Jim put in the example code, and that I noticed the discrepancies. without the example code I would still be scratching my head. that being said I followed up on Jim’s comments that I was looking inthe right direction, and I came up with the line of thinking below. Again this is me thinking out loud, but hopefully at least in the right direction.

Gear_change.bas
cur_pos var word ‘<- sets up the variable for storing the current pot value.
new_pos var word ‘<- Bear with me, I am going this route because I do not know yet how I will be inputting the positions for each gear change yet, so I am pretending I have a input voltage that represents a new gear position value
loop’
adin 0, cur_pos ‘<- the variable cur_pos now holds the numeric value of the current pot(gear) position.
adin 1, new_pos ‘<- the variable new_pos now holds the numeric value of the new gear position.
If cur_pos – new_pos < 0 then
xxxxxxxxxxxxxx’< code that would rotate motor CW towards new gear position If cur_pos – new_pos < 0 if this is false then it would go to next line. (So far I have no thoughts yet on this code. )
If cur_pos – new_pos > 0 then’
xxxxxxxxxxxx ‘< code that would rotate motor CCW towards new gear position If cur_pos – new_pos > 0 if this is false then it would go to next line.
If cur_pos – new_pos = 0 then ‘
End or stop’< if above also false it would go to next line. If true I have shifted to a new gear position and it’s done until I decide to change gears again.
Goto loop’

Actually, after looking at it again it does not seem right, but it’s late, and I am not thinking straight any more. Please give me some input to work with, and have a wonderful day.

I never got an answer, can the pot rotate continuously? Normally they do not. This will complicate things a bit as I think the real pot on the motor can, but your test rig can not. I will throw something together for you to try today.

Is the motor controller replaced yet?

Ok now we will put the code that reads the position in a subroutine. This code should run same as before.

[code]var pot_position word '<- sets up the variable for storing the pot value.
loop: '<- label, you can “goto” here.
gosub get_pot_position
goto loop

get_pot_position:
adin 0, pot_position '<- the variable pot_position now holds the numeric value of the pots position.
serout s_out,i9600,“Analog input reading:”,dec pot_position,13] '<- this sends the value to the PC so you can see it.
pause 100 '<- a small 0.1 second pause, no need to go full speed here.
return '<- this takes you back to the position right after the gosub.[/code]

Now we will implement inputs. We will use the three buttons on the BB2, A, B and C, to shift into three gears. The motor controller will connect to IO 4 on the Bot Board II. The motor controller should be put into RC mode. 1500uS will stop the motor. Sending larger pulses will start rotation in one direction and shorter pulses will rotate the opposite direction. The farther from 1500 the faster the motor will run. The range should be 1000uS to 2000uS. The code for generating these pulses is handled in 0.5uS steps. So to make 1500uS you send a value of 3000. You may need to reverse the wires on the motor if it rotates the wrong direction. I have not tested this but it should be close. There is no PID or anything fancy, just some brute force code to get started. I’m not a great programmer. Anyone else want to assist here?

[code] pot_position var word '<- sets up the variable for storing the pot value.
gear_A con 973 'reverse
gear_B con 817 '1st gear
gear_C con 697 '2nd gear
buttonA var nib '<- nibble variable holds 0-1.
buttonB var nib
buttonC var nib
prevA var nib
prevB var nib
prevC var nib
deadband con 15 '<- we want this as low as will reliably operate.

loop:
buttonA = in12
buttonB = in13
buttonC = in14
  if (buttonA = 0) AND (prevA = 1) then
     gosub select_gearA
  endif
  if (buttonB = 0) AND (prevB = 1) then
     gosub select_gearB
  endif
  if (buttonC = 0) AND (prevC = 1) then
     gosub select_gearC
  endif

prevA = buttonA
prevB = buttonB
prevC = buttonC
goto loop

select_gearA:
gosub get_pot_position
  if (pot_position < (gear_A + deadband)) AND (pot_position > (gear_A - deadband)) then
   pulsout 4, 3000 '<- stop the motor if running
  return
  endif
  if pot_position > (gear_A + deadband) then
   pulsout 4, 2600 '<- 1300uS (change this to move faster or slower)
  goto select_gearA
  endif
  if pot_position > (gear_A - deadband) then
   pulsout 2, 3400
  goto select_gearA
  endif

select_gearB:
gosub get_pot_position
  if (pot_position < (gear_B + deadband)) AND (pot_position > (gear_B - deadband)) then
   pulsout 4, 3000 '<- stop the motor if running
  return
  endif
  if pot_position > (gear_B + deadband) then
   pulsout 4, 2600 '<- 1300uS (change this to move faster or slower)
  goto select_gearB
  endif
  if pot_position > (gear_B - deadband) then
   pulsout 2, 3400
  goto select_gearB
  endif

select_gearC:
gosub get_pot_position
  if (pot_position < (gear_C + deadband)) AND (pot_position > (gear_C - deadband)) then
   pulsout 4, 3000 '<- stop the motor if running
  return
  endif
  if pot_position > (gear_C + deadband) then 
   pulsout 4, 2600 '<- 1300uS (change this to move faster or slower)
  goto select_gearC
  endif
  if pot_position > (gear_C - deadband) then
   pulsout 2, 3400
  goto select_gearC
  endif

get_pot_position:
adin 0, pot_position
serout s_out,i9600,"Analog input reading:",dec pot_position,13]
pause 100
return  [/code]

Wow Jim, you sent me a lot of stuff. Thank you. I will take my time and go over it.
I just wanted to quickly answer the question about the pot. The pot on the test rig is the actual pot from the gearbox. It can in fact rotate continuously, but installed on the gearbox it never would be able to. It’s actual range of travel is 350 degrees. again thank you. I am going to be up late tonight.
Andre

Hi all , OK, I have read thru the codes that Jim wrote for me, and I can pretty much follow the logic of it. Thank you Jim. And please, as Jim stated earlier, any other ideas or comments will be greatly appreciated. The replacement Syren-10 motor controller has not arrived yet, so I can’t do any actual testing yet. It does give me the chance to go over Jim’ s code and ask questions, because I want to know how and why things work, and just telling me to do it this way does not work for me.
Hopefully I won’t ask any really stupid questions, and if I do please bear with me. My experience has taught me that stupid questions are exponentially less expensive than stupid mistakes.
So, first question, looking back at my mistake with the reverse polarity that fried my first SyRen motor controller. is there any reason why I cannot install a 10Amp blocking diode in the wires to the battery? and of course why?
Next, the motor controller will have to be powered from the 12 Volt system of the car. the BB2 can only accept a max of 9 V. I remember reading that BB2 needs at least 5.5V at the Vlogic input to be able to output 5V+ to the pot for instance. does this mean that I will need a separate regulated power supply of maybe 7.5V for the BB2 or can I use the +5V out from the SyRen to power both the BB2 Vlogic input and the 0V/+5V to the gearbox pot and have the pot center tab go to P0 input on the BB2, all of this of course with all the grounds being common. Ok, so it’s very late again, but I have searched all over for references to the Prev expression in the code, and nothing. I am guessing that it has something to do with these buttons being momentary on buttons, so something like if within a certain time frame there is both a 0 and a 1 input then it means the button was pushed. I am also assuming that you used the 3 buttons on the BB2 simply because they are already there and this is only testing and that we will use external momentary switches connected to the BB2 inputs for the real deal. What really gets me is that 40 years ago in college I went with Civil Engineering instead of Electrical Engineering because of the Calculus requirements for the EE degree. I could not comprehend calculus at all. Looking back, I never did a day’s work as a Civil Engineer in my life, but have been involved with electrically powered equipment and their maintenance ever since I graduated from College. Go figure. I will be back later.