[Ovmsdev] Brake light control (was Re: Prototyping expansion board)

Tamás Kovács kommykt at gmail.com
Tue Apr 23 01:24:51 HKT 2019


Now I tested a little bit. Works fine, bright the led when recuperating.
But I look at the code and I not understand:

accel = (speed - m_accel_refspeed) / (now - m_accel_reftime) * 1000; //
smooth out road bumps & gear box backlash:accel =
(StdMetrics.ms_v_pos_acceleration->AsFloat() * m_accel_smoothing + accel) /
(m_accel_smoothing + 1);

Use same variable, I think the first is unnecessary now.


Michael Balzer <dexter at expeedo.de> ezt írta (időpont: 2019. ápr. 22., H,
11:13):

> Pushed:
>
>
> https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/commit/b44d466580b6961ada5ae42500c3fea68cab0f8a
>
> - Vehicle framework: regenerative braking signal generation
>
>   New config:
>     vehicle [accel.smoothing] = 2.0     Acceleration smoothing factor
> (samples, 0 = none)
>     vehicle [brakelight.enable] = no    Regen brake light enable
>     vehicle [brakelight.port] = 1       … MAX7317 output port number (1,
> 3…9, default 1 = SW_12V)
>     vehicle [brakelight.on] = 1.3       … activation threshold
> (deceleration in m/s²)
>     vehicle [brakelight.off] = 0.7      … deactivation threshold
> (deceleration in m/s²)
>
>   New metrics:
>     v.p.acceleration    = acceleration/deceleration in m/s² derived from
> v.p.speed
>     v.e.regenbrake      = regenerative brake light state
>
> - Twizy web UI: regenerative braking signal configuration
>
>
> I've tested this using an LED on EGPIO_8, I'll do & document the Twizy
> hardware modification next weekend (if I receive my order in time…).
>
> @Tamás: to add the UI to the Mitsubishi code:
>
>
> https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/blob/master/vehicle/OVMS.V3/components/ovms_webserver/src/web_displays.cpp#L1127
>
> Regards,
> Michael
>
>
> Am 22.04.19 um 04:12 schrieb Mark Webb-Johnson:
>
> Yes, EGPIO1 had to be used for SN65 control so is not available for
> general use.
>
> Max7317 has 10 outputs (P0 .. P9):
>
>
>    - P0 MDM EN (controls modem power)
>    - P1 SW CTL (to BTS452 for EXT 12v power control)
>    - P2 EGPIO1 (SN65 transceiver power saving control)
>    - P3 EGPIO2 available for general use
>    - P4 EGPIO3 available for general use
>    - P5 EGPIO4 available for general use
>    - P6 EGPIO5 available for general use
>    - P7 EGPIO6 available for general use
>    - P8 EGPIO*7* available for general use
>    - P9 EGPIO*8* available for general use
>
>
> Regards, Mark
>
> On 22 Apr 2019, at 3:36 AM, Michael Balzer <dexter at expeedo.de> wrote:
>
> Mark,
>
> btw: is EGPIO_1 not free for general use? The esp32can SN65 seems to be
> controlled by that line.
>
> Regards,
> Michael
>
>
> Am 21.04.19 um 15:01 schrieb Mark Webb-Johnson:
>
> If changing vehicle.{h, cpp} framework, I suggest leaving a hook in to
> allow the vehicle module to override / supplement this. In particular, the
> brake light may be controllable via can message on some vehicles.
>
> You can look at the ext12v circuit to see how to control this.
>
> The ext12v system is a switchable 12v line already wired up and available
> on DA26 expansion. Would be trivial to put an external relay on that to
> switch brake lights.
>
> Regards, Mark.
>
> On 21 Apr 2019, at 1:32 AM, Tamás Kovács <kommykt at gmail.com> wrote:
>
> JP1 pin 1 (+3.3) ----- [ 680 Ohms ] ---+--- [ LED ] ----- pin 28 (GND)
>                                        |
>                                     pin 12 (EGPIO_8)
>
> I can connect a 680Ohm resistor first end to pin1, a second end to pin12,
> and the led positive side to pin12 and negative to pin28(gnd). Now I have
> only 470ohm resistor at home, I tested now with a 4V li-ion battery and my
> red led power is 4mA. I can use this (470Ohm) resistor or buy a 680Ohm.
> Tomorrow I remove the OVMS module from my car, and create some test, if
> the resistor (470Ohm) is OK.
> I used this calculator for led series resistor calculation (I used a red
> Led): http://ledcalc.com
>
> Michael Balzer <dexter at expeedo.de> ezt írta (időpont: 2019. ápr. 20.,
> Szo, 11:16):
>
>> Be aware the MAX71317 outputs are open drain, so you need a pull up
>> resistor to e.g. +3.3. According to the data sheet, the current should stay
>> below 6 mA.
>>
>> I've just done a quick test wiring like this:
>>
>> JP1 pin 1 (+3.3) ----- [ 680 Ohms ] ---+--- [ LED ] ----- pin 28 (GND)
>>                                        |
>>                                     pin 12 (EGPIO_8)
>>
>> Works as expected.
>>
>> Regards,
>> Michael
>>
>>
>> Am 19.04.19 um 09:59 schrieb Michael Balzer:
>>
>> Sure.
>>
>> You need to route an EGPIO line to the DA26 port. For a first test you
>> can add a simple jumper on expansion port pins 10/12 to route EGPIO_8 to
>> GEP_7 (= pin 21 on DA26).
>>
>> You should then be able to use the "egpio" command to test your LED.
>> EGPIO_1 … _8 labels correspond to MAX7317 ports 2 … 9, so to control
>> EGPIO_8, do:
>>
>> OVMS# egpio output 9 1  # EGPIO_8 on
>> OVMS# egpio output 9 0  # EGPIO_8 off
>>
>> (correct me if I'm wrong, Mark)
>>
>> I wasn't aware there are other cars in need of something like this. I'll
>> think about adding the logic as an option to the vehicle framework, but I
>> can send you some patch to test this on your i-MiEV/clone first.
>>
>> Regards,
>> Michael
>>
>>
>> Am 19.04.19 um 09:24 schrieb Tamás Kovács:
>>
>> I can add for testing a simple led (with resistor) , same as
>> SimpleConsole (twizy OVMS V2), to show car is recuperating, connected to
>> DA26 external expansion port?
>>
>> Michael Balzer <dexter at expeedo.de> ezt írta (időpont: 2019. ápr. 19., P,
>> 9:17):
>>
>>> As the Mitsubishi code also reads battery current/power level from CAN,
>>> it would be trivial to add the same logic there.
>>>
>>>
>>> Am 19.04.19 um 06:52 schrieb Tamás Kovács:
>>>
>>> The Trio (Mitsubishi I-Miev and clones) does not activate the brake
>>> light on recuperation on 2105 and older models, if this is work is very
>>> impressive.
>>>
>>> Michael Balzer <dexter at expeedo.de> ezt írta (időpont: 2019. ápr. 18.,
>>> Cs, 23:08):
>>>
>>>> Mark,
>>>>
>>>> that looks very good. Not sure about general demand, but I think we
>>>> should have this to enable simple custom hardware I/O extensions.
>>>>
>>>> For the Twizy, I was thinking about adding logic to control the brake
>>>> light from the module. The Twizy does not activate the brake light on
>>>> recuperation, as that's normally (untuned) not very strong. But a tuned
>>>> Twizy allows one pedal driving, so needs this.
>>>>
>>>> Looking at our case I also think one custom extension board should fit
>>>> on top of the modem.
>>>>
>>>> Regards,
>>>> Michael
>>>>
>>>>
>>>> Am 18.04.19 um 02:36 schrieb Mark Webb-Johnson:
>>>>
>>>> It seems the attachments were messed up, so attaching again…
>>>>
>>>> Regards, Mark.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 17 Apr 2019, at 10:07 PM, Mark Webb-Johnson <mark at webb-johnson.net>
>>>> wrote:
>>>>
>>>>
>>>> Design layout. Looks good to me, but open to suggestions...
>>>>
>>>>
>>>> We can make in sets of three PCBs, to keep prices down.
>>>>
>>>>
>>>> Regards, Mark
>>>>
>>>>
>>>> On 8 Apr 2019, at 12:05 PM, Mark Webb-Johnson <mark at webb-johnson.net>
>>>> wrote:
>>>>
>>>>
>>>> A kit of 5 PCBs + SIP edge connectors + mounting hardware, unsoldered,
>>>> would be about US$15 + shipping. About US$3/board set. With shipping I
>>>> don’t think this is worth doing with less than 3 or 5 boards per kit.
>>>>
>>>> Would this be useful?
>>>>
>>>> Regards, Mark.
>>>>
>>>> On 7 Apr 2019, at 9:08 PM, Mark Webb-Johnson <mark at webb-johnson.net>
>>>> wrote:
>>>>
>>>> This is the closest we have today:
>>>>
>>>> <image1.jpeg>
>>>>
>>>> That is a bare modem board, with just the sip connectors. The prototype
>>>> above is a K-line transceiver.
>>>>
>>>> I think it would be trivial, and cheap, to make up what you show.
>>>> Perhaps just solder ready pads at 0.1” pitch, then the side sip connectors
>>>> wired to the first row of pads at each edge. Perhaps 5 PCBs in a kit, with
>>>> sip edge connectors, unsoldered, in a simple plastic bag.
>>>>
>>>> Does that sound like something useful? If so, I can ask the China guys
>>>> for some idea of pricing. If it is just the unsoldered pcbs + parts, I
>>>> don’t think it will be expensive.
>>>>
>>>> Regards, Mark
>>>>
>>>> On 7 Apr 2019, at 4:38 PM, Michael Balzer <dexter at expeedo.de> wrote:
>>>>
>>>> Mark,
>>>>
>>>> do you know of some kind of prototyping board available that fits to
>>>> our piggy back expansion layout?
>>>>
>>>> Something like this:
>>>> https://www.robotshop.com/de/de/cytron-arduino-proto-schild.html
>>>>
>>>> Regards,
>>>> Michael
>>>>
>>>>
>>>> Am 03.04.19 um 06:48 schrieb Mark Webb-Johnson:
>>>>
>>>>
>>>> If you have work to do on this DA26 expansion ports, this is pretty
>>>> cool and well built:
>>>>
>>>>
>>>> https://www.aliexpress.com/item/26-Pin-D-SUB-DB26-3-Rows-Serial-Parallel-Port-Serial-Shellless-Male-And-Female-Connector/32886738786.html?spm=a2g0s.9042311.0.0.20924c4dg34EEU
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>>
>>>> --
>>>> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
>>>> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.openvehicles.com
>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.openvehicles.com
>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.openvehicles.com
>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.openvehicles.com
>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>>
>>>> --
>>>> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
>>>> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>>>>
>>>> _______________________________________________
>>>> OvmsDev mailing list
>>>> OvmsDev at lists.openvehicles.com
>>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>>
>>>
>>>
>>> --
>>> Üdvözlettel:
>>> Kovács Tamás
>>>
>>> _______________________________________________
>>> OvmsDev mailing listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>
>>>
>>> --
>>> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
>>> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>>>
>>> _______________________________________________
>>> OvmsDev mailing list
>>> OvmsDev at lists.openvehicles.com
>>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>>
>>
>>
>> --
>> Üdvözlettel:
>> Kovács Tamás
>>
>> _______________________________________________
>> OvmsDev mailing listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>
>>
>> --
>> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
>> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>>
>>
>> _______________________________________________
>> OvmsDev mailing listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>
>>
>> --
>> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
>> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>>
>> _______________________________________________
>> OvmsDev mailing list
>> OvmsDev at lists.openvehicles.com
>> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>>
>
>
> --
> Üdvözlettel:
> Kovács Tamás
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
>
>
> _______________________________________________
> OvmsDev mailing listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
>
> --
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
>
>
> _______________________________________________
> OvmsDev mailing listOvmsDev at lists.openvehicles.comhttp://lists.openvehicles.com/mailman/listinfo/ovmsdev
>
>
> --
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev
>


-- 
Üdvözlettel:
Kovács Tamás
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20190422/011827f6/attachment.htm>


More information about the OvmsDev mailing list