Converting my product to Open Source and using the Prop
eagletalontim
Posts: 1,399
Well, it is about time to release my product to the market as an Open Source project since I now have a competitor who has completely ruined the profit margin and is copying everything I do. Having the product converted to open source, I can begin a different type of approach to the issue. Basically what I have been doing is controlling an automatic transmission using the SX chip. Currently, the design is very simple using 2 buttons to let the user change gears (Up or down), and reading the RPM of the engine to stop downshifting when over a specific RPM. A 7 segment display shows what gear the transmission is in. I am hoping to convert fully to the Prop and have many more features available.
With the Prop, I can do sooo much more which is what I would like to do....but I need help since I am just now learning the Prop and the language. For now, I would like to simply recreate the product using the Prop as the brain. The problem is, I don't know what limits I have on the Prop when it comes to current supply and driving Mosfets or transistors to channel 12v positive to the solenoids. I have read some posts on how to do this, but I need a reliable way that is surface mount and cheaper than $0.75 each. I want to keep as much as possible surface mount due to size and cost. The 12v side is basically 12 to 14.5 volts and the solenoids are 30 ohm to 130 ohm. I have calculated 0.4 to 0.5 amps to activate the solenoid. On the current design, I am using an NPN transistor connected to a pin on the SX, then a TIP42 PNP transistor to control the power to the solenoid.
Here is a link to the transistors :
NPN : https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10001&langId=-1&catalogId=10001&productId=26462
PHP : https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10001&langId=-1&catalogId=10001&productId=33101
I can post a simple schematic of how it is connected if needed. I tested running just a mosfet directly from the pin which worked on the SX, but I am not sure on the Prop. I only have 1 development board for now If I could get some help with this project, I would greatly appreciate it! It sucks having something I created be taken right from under me with no care from the other person. With this, I am sure I can really spice things up a bit! So far, I have purchased Jameco's 1206 surface mount resistor bundle pack which came with 11k 1/4W resistors. I am sure I am set there for awhile
With the Prop, I can do sooo much more which is what I would like to do....but I need help since I am just now learning the Prop and the language. For now, I would like to simply recreate the product using the Prop as the brain. The problem is, I don't know what limits I have on the Prop when it comes to current supply and driving Mosfets or transistors to channel 12v positive to the solenoids. I have read some posts on how to do this, but I need a reliable way that is surface mount and cheaper than $0.75 each. I want to keep as much as possible surface mount due to size and cost. The 12v side is basically 12 to 14.5 volts and the solenoids are 30 ohm to 130 ohm. I have calculated 0.4 to 0.5 amps to activate the solenoid. On the current design, I am using an NPN transistor connected to a pin on the SX, then a TIP42 PNP transistor to control the power to the solenoid.
Here is a link to the transistors :
NPN : https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10001&langId=-1&catalogId=10001&productId=26462
PHP : https://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?storeId=10001&langId=-1&catalogId=10001&productId=33101
I can post a simple schematic of how it is connected if needed. I tested running just a mosfet directly from the pin which worked on the SX, but I am not sure on the Prop. I only have 1 development board for now If I could get some help with this project, I would greatly appreciate it! It sucks having something I created be taken right from under me with no care from the other person. With this, I am sure I can really spice things up a bit! So far, I have purchased Jameco's 1206 surface mount resistor bundle pack which came with 11k 1/4W resistors. I am sure I am set there for awhile
Comments
Edit : My product is known world wide in the car community I am in which is a definite plus for me, but my customers are 1 time buyers. If you needed something to fix an issue but had the option to pay 2/3 cheaper for a product that does the exact same thing, why would you want to go the more expensive route? Open Source would be a better alternative IMO. It gives the product a wide range of abilities rather than being stuck with something that can't do much more than it already offers. There are plenty of people who are well more educated in the automotive and electronic field who could help create new things for the product but users still need a base to start from. That is what I would like to offer.
The Prop will work fine with the NPN->PNP follower configuration.
This way, you can compete on your device being robust and not just cheap.
Bean
[PHP]
' All code is copyright and is not authorized for resale or redistribution
DEVICE SX28, OSCXT2, TURBO, STACKX, OPTIONX
FREQ 5_000_000
level_up PIN RA.0 INPUT
level_down PIN RA.1 INPUT
TachIn PIN RB.4 INPUT SCHMITT
sol_a VAR RB.0
sol_b VAR RB.1
TRIS_sols VAR TRIS_B
TRIS_disp VAR TRIS_C
level VAR Byte
newlevel VAR Byte
isrpm VAR BYTE
rpm VAR WORD
pWidth0 VAR WORD
pWidth1 VAR WORD
dividendMSW VAR WORD
dividendLSW VAR WORD
overflow VAR BIT
doneBit VAR BIT
' Sparks = Cylinder / 2
sparks CON 2
' RPM is in 100s EX: RPM = RPM / 100
autoshift CON 75 '00
shiftlock CON 45 '00
gearonelock CON 30 '00
GET_RPM FUNC 2, 0
Set_level SUB 1, 1
display_boot SUB 0
wait SUB 1, 2
LIMP_MODE SUB 1
PROGRAM Start
Start:
TRIS_sols = %11111100
TRIS_disp = %00000000
display_boot
level = 1
Set_level 1
isrpm = 1
Main:
rpm = GET_RPM
IF rpm > 3 THEN
IF rpm < 120 THEN
isrpm = 1
ELSE
isrpm = 0
LIMP_MODE 1
ENDIF
ELSE
isrpm = 0
LIMP_MODE 0
ENDIF
IF rpm >= autoshift THEN
level = level + 1
IF level >= 4 THEN
level = 4
ENDIF
Set_level level
do while rpm > autoshift
rpm = GET_RPM
IF level_up <> 0 THEN
EXIT
ELSEIF level_down <> 0 THEN
EXIT
ENDIF
loop
ENDIF
IF level_up <> 0 THEN
level = level + 1
IF level >= 4 THEN
level = 4
ENDIF
Set_level level
ENDIF
IF level_down <> 0 THEN
IF rpm <= shiftlock THEN
IF level > 2 THEN
level = level - 1
ELSEIF level == 2 THEN
IF rpm <= gearonelock THEN
level = level - 1
ENDIF
ENDIF
ENDIF
IF level <= 1 THEN
level = 1
ENDIF
Set_level level
ENDIF
GOTO Main
Button_Pressed:
do while level_up <> 0
wait 500
loop
do while level_down <> 0
wait 500
loop
GOTO Main
Set_level:
newlevel = __PARAM1
IF newlevel = 1 THEN
sol_b = 1
sol_a = 1
RC = %00110000
ENDIF
IF newlevel = 2 THEN
sol_b = 0
sol_a = 1
RC = %01101110
ENDIF
IF newlevel = 3 THEN
sol_b = 0
sol_a = 0
RC = %01111010
ENDIF
IF newlevel = 4 THEN
sol_b = 1
sol_a = 0
RC = %00110011
ENDIF
wait 500
IF level_up <> 0 THEN
GOTO Button_Pressed
ELSEIF level_down <> 0 THEN
GOTO Button_Pressed
ELSE
RETURN
ENDIF
LIMP_MODE:
level = __PARAM1
do
RC = %01001111 ' ERROR : Shows E
wait 1000
IF level = 1 THEN
RC = %00110111 ' High : Shows H
ELSE
RC = %00001101 ' Low : Shows L
ENDIF
wait 1000
loop
return
display_boot:
RC = %11111100
wait 500
RC = %11111001
wait 500
RC = %11110101
wait 500
RC = %11101101
wait 500
RC = %11011101
wait 500
RC = %10111101
wait 500
RC = %00000000
RETURN
FUNC GET_RPM
PULSIN TachIn, 0, pWidth0
PULSIN TachIn, 1, pWidth1
pWidth0 = pWidth0 + pWidth1
pWidth0 = pWidth0 * sparks
dividendMSW = $005B
dividendLSW = $8D80
rpm = 1
overflow = 0
DO
doneBit = rpm.15
rpm = rpm << 1
IF overflow = 1 THEN
rpm.0 = 1
dividendMSW = dividendMSW - pWidth0
ELSE
IF dividendMSW >= pWidth0 THEN
rpm.0 = 1
dividendMSW = dividendMSW - pWidth0
ENDIF
ENDIF
overflow = dividendMSW.15
dividendMSW = dividendMSW << 1
dividendMSW.0 = dividendLSW.15
dividendLSW = dividendLSW << 1
LOOP UNTIL doneBit = 1
rpm = rpm << 1
rpm.0 = overflow
IF dividendMSW >= pWidth0 THEN
rpm.0 = 0
ENDIF
rpm = rpm / 100
RETURN rpm
ENDFUNC
wait:
IF __PARAMCNT = 1 THEN
PAUSE __PARAM1
ELSE
PAUSE __WPARAM12
ENDIF
RETURN[/PHP]
You can easily follow how it works and get an idea of what it is doing since I laid out the code as clean as I could.
Below is what I have come up with for the Prop so far :
[PHP]CON
_CLKMODE = XTAL1 + pll16x
_XINFREQ = 5_000_000
solenoida = 2
solenoidb = 3
upbutton = 0
downbutton = 1
VAR
long lastWritten
BYTE EVal1
byte throttle
OBJ
i2c : "Basic_I2C_Driver"
BS2 : "BS2_Functions"
throt : "RCTIME"
lcd : "Serial_Lcd"
num : "simple_numbers"
PUB Main(gear)
lcd.init(15, 9600, 2)
lcd.displayON
lcd.backLight(true)
lcd.gotoxy(0,0)
lcd.str(string("Testing Version "))
lcd.gotoxy(0,1)
lcd.str(string("Tims shifter V1 "))
BS2.start (31,30)
EVal1 := 100
gear := i2c.ReadLong(i2c#BootPin, i2c#EEPROM, @EVal1)
if gear < 1 OR gear > 4
gear := 1
gear := shiftgear(gear)
lcd.cls
lcd.str(string("Gear: "))
lcd.gotoxy(5,0)
lcd.str(num.dec(gear))
repeat
throttle := getthrottle
if ina[upbutton] == 1
gear++
gear := shiftgear(gear)
if ina[downbutton] == 1
gear--
gear := shiftgear(gear)
repeat while ina[downbutton] == 1 or ina[upbutton] == 1
waitcnt(30_000_000 + cnt)
waitcnt(1_000_000 + cnt)
PUB shiftgear(tmp)
if tmp > 4
tmp := 4
if tmp < 1
tmp := 1
'throttle := getthrottle(tmp)
dira[solenoida]~~
dira[solenoidb]~~
outa[16..23]~
dira[16..23]~~
if tmp == 1
outa[solenoida] := 1
outa[solenoidb] := 1
if tmp == 2
outa[solenoida] := 0
outa[solenoidb] := 1
if tmp == 3
outa[solenoida] := 0
outa[solenoidb] := 0
if tmp == 4
outa[solenoida] := 1
outa[solenoidb] := 0
outa[16..23] := numbers[tmp]
saveval(tmp)
lcd.gotoxy(5,0)
lcd.str(num.dec(tmp))
return tmp
PUB saveval(tmp) | temp, startTime
temp := tmp
if temp <> lastWritten and temp <> 0
if i2c.WritePage(i2c#BootPin, i2c#EEPROM, @EVal1, @tmp, 4)
abort ' an error occured during the write
startTime := cnt ' prepare to check for a timeout
repeat while i2c.WriteWait(i2c#BootPin, i2c#EEPROM, @tmp)
if cnt - startTime > clkfreq / 10
abort ' waited more than a 1/10 second for the write to finish
lastWritten := temp
PUB getthrottle | thr
dira[5]~~ ' Set as output
outa[5]:=1 ' Set high
BS2.Pause(10) ' Allow to charge
throttle := BS2.RCTime(5,1) ' Measure RCTime
lcd.gotoxy(13, 0)
lcd.str(string(" "))
lcd.gotoxy(13, 0)
lcd.str(num.dec(throttle)) ' Display
return throttle
DAT
numbers byte %0000_0000, %0101_0000, %1100_1110, %1101_1010, %0101_0011 [/PHP]
Yes. Worst case on resistance is < 0.3 ohms per channel, and total device power dissipation should not exceed 0.9W. P=(I^2)R, I=sqrt(P/R), so max combined current is 1.8A. Just make sure you attach the thermal slug to a plane on your circuit board.
You should probably have one external protection component, namely a reverse diode to ground, but that's much simpler than several parts to make the circuit you had.
EDIT : Maybe I have something wrong since letting the circuit stay on with just the display connected, the regulator got very warm. I am using 100 ohm resistors going to each anode on the display. The cathode goes directly to ground. Do I need more resistance? The specs of the display are here : http://www.kingbrightusa.com/images/catalog/SPEC/SC03-12EWA.pdf
The resistors used on the display should be determined by how bright you want it.
As I mentioned before, an off-board 7809 may be easier for now.
For the display, 100 ohms is probably okay, but it really depends how bright you want it. 330 would be much dimmer, but also 1/3 of the current. That's up to you and your requirements.
If you use linear regulators, the power dissipation will always be the same no matter what part you use. Switching regulators have different challenges to them, pre-built units are expensive, and it sounds like you don't have the experience to build one yet. One easy solution is to bolt a 7809 to your case, if it's metal, and run everything off that. Better yet if you can find a 7.5v regulator.
So far with the 7812 regulator set at 8.8V, everything seems to be staying below "hot". The 7812 and the 5v regulator are warm to the touch without heatsinks. Without the 7812, the 5v regulator got hot. Should I order a small heatsink for the regulators? I already have the mosfets in my cart on digikey, but probably need to order more. The more per order saves on shipping in the long run!
EDIT : Would something like this work or would I need a bigger heatsink? http://search.digikey.com/us/en/products/577102B04000G/HS368-ND/1216373
EDIT : I found this on Digikey : http://search.digikey.com/us/en/products/NCP1117DT33G/NCP1117DT33GOS-ND/1483318 Would that work or should I go with a to-220 case to mount a heatsink to it?
http://search.digikey.com/us/en/products/LM1086IT-3.3%2FNOPB/LM1086IT-3.3-ND/363579
Would I need a better 5v regulator since the 7805 only outputs 1A? The 3.3 would basically pull the max from the 7805 which would generate heat.
The 3.3 regulator won't draw more than is drawn from it. The prop doesn't draw more than 120ma, so unless there's more on the 3.3v rail than the prop and the EEPROM, you'll be fine.
Heat doesn't come from things being overloaded, but from any draw at all. So, any 3.3v regulator will dissipate ((5-3.3)*.12)=.204 watts. So, look into thermal resistance values listed in the datasheet for whatever regulator you use to see what temperature rise you'll face.
Mcp1700t will handle the prop and EEPROM just fine and it's $0.44 in quantity 1.
The 5v rail needs to handle your lcd as well. I'll assume 1 amp can power it. The lm2576 is a bit harder to use than an LDO, but it'll take up to 40v in and will dissipate minimal power since it's a switching regulator. The lm2574 is just like the 2576, but it's surface mount and has a lower current limit (500ma vs 3a).
Just to take that point from Circuitsoft a little further, switching regulators hardly even get warm at 1A and so don't need a heatsink, no matter what the input voltage. They convert one voltage to another rather than 'throwing away' voltage as heat. I've been using switching regulators almost 100% on all my propeller projects, mainly because you save board space by not needing a heatsink and when you work out the cost of the components vs the cost of the board space, switchers seem to work out cheaper.