GPIO'4'Cars, the way to drive your car with N2!

Post Reply
User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

mctom wrote:
Mon Mar 11, 2024 3:51 pm
If I saw anything to improve here, MOSFET drivers should be placed close to MOSFETs themselves. Longer Gate track has higher capacitance and we don't want that. We keep it short by placing driving N-FET and Gate-Source resistor close to MOSFET.
Good to know, add it to my todo list :)

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

Deleted
Last edited by zyssai on Mon Apr 22, 2024 12:25 am, edited 1 time in total.
These users thanked the author zyssai for the post:
odroid (Thu Mar 21, 2024 9:45 am)

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

I made new keymatrix overlay file, it is working perfectly, thanks to joerg, so I uploaded it and updated tutorial.

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

I also did a guide for OS installation.
So you can set up everything from scratch.
These users thanked the author zyssai for the post:
mctom (Sat Apr 27, 2024 10:52 pm)

User avatar
mctom
Posts: 4217
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polski
ODROIDs: XU4, M1, H3+, SP3, N2L, M1S, N2
Location: Gdańsk, Poland
Has thanked: 622 times
Been thanked: 854 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by mctom »

I'm glad you are fully protected against legal action and disclaimed any responsibility for cat attacks :lol:
Punk ain't no religious cult, punk means thinking for yourself!
OpenUPS
PiStackMon

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

mctom wrote:
Sat Apr 27, 2024 10:56 pm
I'm glad you are fully protected against legal action and disclaimed any responsibility for cat attacks :lol:
We never know, I prefer to prevent it :D

I must tell you Marktext is a must have, thanks to let me know this!

User avatar
codewalker
Posts: 2248
Joined: Mon Feb 25, 2013 11:03 am
languages_spoken: english
ODROIDs: all
Has thanked: 86 times
Been thanked: 233 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by codewalker »

Hi zyssai.
You can control a new display backlight by doing the following:

Code: Select all

$ adb shell
odroidn2:/ # vi /odm/env.ini 
overlays="i2c0 i2c1 spi0 uart0 pwm_cd pwm_ef pwm_backlight"
https://wiki.odroid.com/accessory/displ ... _odroid-n2

https://wiki.odroid.com/odroid-n2/hardw ... connectors

Image
Image
Last edited by codewalker on Tue Apr 30, 2024 5:03 pm, edited 1 time in total.
These users thanked the author codewalker for the post:
zyssai (Tue Apr 30, 2024 5:02 pm)

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

Hi!

Thanks!
I see there is a switch to set external PWM, that's a great news :)
Last edited by zyssai on Sat May 04, 2024 4:38 pm, edited 1 time in total.

User avatar
joerg
Posts: 2123
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4, M1, M1S
Location: Germany
Has thanked: 221 times
Been thanked: 492 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by joerg »

@codewalker: And what display is ODROID-VU1?????

User avatar
mad_ady
Posts: 12061
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, N2L, H2, H3+, Go, Go Advance, M1, M1S
Location: Bucharest, Romania
Has thanked: 663 times
Been thanked: 1309 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by mad_ady »

I'd say it's a VU10, instead... :D

User avatar
joerg
Posts: 2123
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2, N1, N2, C4, M1, M1S
Location: Germany
Has thanked: 221 times
Been thanked: 492 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by joerg »

Anybody offers more than 10? :D

User avatar
odroid
Site Admin
Posts: 42543
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3735 times
Been thanked: 2103 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by odroid »

It seems to be 12.3. ;)
These users thanked the author odroid for the post:
joerg (Sat May 04, 2024 2:57 pm)

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

codewalker wrote:
Tue Apr 30, 2024 4:53 pm
Hi zyssai.
You can control a new display backlight by doing the following:

Code: Select all

$ adb shell
odroidn2:/ # vi /odm/env.ini 
overlays="i2c0 i2c1 spi0 uart0 pwm_cd pwm_ef pwm_backlight"
Hi!

I tried, it works!
But I only found a pwm signal at pin 12 of N2. Is this a normal behavior?

User avatar
odroid
Site Admin
Posts: 42543
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3735 times
Been thanked: 2103 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by odroid »

Can you clarify the issue?
Does it mean that the LCD backlight control connected to PMW_C (Pin#33) works okay and PWM_E (Pin#12) also works okay, but PWM_D (Pin#32) and PWM_F (Pin#15) do not work?

Image

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

I think I need to double check, but either pwm_cd pwm_backlight or pwm_ef pwm_backlight do not work, I have nothing at pin 33 like @codewalker suggested, no signal with oscilloscope, but I have found it at pin 12.
I have no other overlays.

User avatar
odroid
Site Admin
Posts: 42543
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3735 times
Been thanked: 2103 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by odroid »

We've checked with an oscilloscope and we confirmed only PWM_C Pin 33 shows 1Khz PWM output.
Other PWM_D, PWM_E and PWM_F pins don't show any wave form.

BTW, did you set the slide-switch position to "External PWM" as codewalker's picture?

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

odroid wrote:
Mon May 13, 2024 3:52 pm
BTW, did you set the slide-switch position to "External PWM" as codewalker's picture?
Absolutely, it works, but I need to take PWM from pin 12. Very strange, I will retry soon with LOS20 from scratch.

User avatar
odroid
Site Admin
Posts: 42543
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3735 times
Been thanked: 2103 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by odroid »

We've used only our official images. I think LOS might have a different DTBO behaviors.
These users thanked the author odroid for the post:
zyssai (Mon May 13, 2024 5:23 pm)

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

odroid wrote:
Mon May 13, 2024 4:25 pm
We've used only our official images. I think LOS might have a different DTBO behaviors.
BTW, does HK plan to make a more updated version of official android as Pie is a bit outdated especially with Play Store apps?

User avatar
odroid
Site Admin
Posts: 42543
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3735 times
Been thanked: 2103 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by odroid »

We don't have any firm plan.
We forwarded some driver/DT patches related to the 12inch backlight to Voodik.
I hope he will merge the patches and release a update package soon.

BTW, could you adjust the backlight brightness with Pin #12 PWM_E on the LOS20 settings menu?
These users thanked the author odroid for the post:
zyssai (Thu May 16, 2024 7:36 pm)

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

Yes absolutely, android slider is working so this is not a real problem.

edgedj
Posts: 8
Joined: Thu Feb 29, 2024 8:48 am
languages_spoken: english
ODROIDs: N2+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by edgedj »

firstly I apologise for asking something that's outside of the scope of this excellent design. At the present time I'm unable to use my Odroid N2+ as I can't get the touchscreen (4inch from waveshare) to work with the Odroid so I'm back to a raspberry Pi 5 for my dashboard project (it's a very small car and it's the biggest screen I can squeeze in!

I've got to the point of powering the GPIO 4 Cars board and getting it to turn on the power based on the presence wire connected to my ignition switch, that stays on nice and steadily and turns off after a good couple of minutes. I've tried putting a meter on the 40p header and seeing if I can detect varying voltages or grounds according to presence but I don't. I suspect this is because the switching from the board is expecting a +3.3v voltage on a pin which it will pull down to ground to act as the physical switch on the pi. Has anyone else been here or can anyone explain to me what I might do next to get the signal about presence in the GPIO 4 Cars board into the pi?

As a fallback I have a completely separate opt-isolator breakout board that will let me independently monitor the state of my ignition +12v switch and pick up that drop in the pi and issue the shutdown - that will work but it seems a waste as I'm certain this is all built into the GPIO 4 Cars module but I really really wish I'd paid more attention in GCSE physics instead of trying to get lumps of chewed up paper to stick to the ceiling when spat through a biro pen when the teacher wasn't watching :|

... progress update, to add to the above, I've been looking at the the pinout of the pi5 and the Odroid N2+ and they are pretty similar, I guessed that the GPIO 4 Cars module is looking for 5v to detect shutdown of the Odroid - well a difference with the pi5 is that it leaves +5v on pins 2 and 4 even when off! so a little bit of head scratching and I plugged in a little USB to 5v lead which I use to charge my MTB headlight and hey that gives +5v when the pi5 is on but not when off so I've connected that to the GPIO 4 Cars pin 4 and fantastic when the pi5 shuts down it cuts the power completely. Oh and I'm powering the pi5 with a 12v - USB car cigarette lighter adaptor.

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

Hi,

Firstly you can probably check this topic, it can help you with your screen.

GPIO'4'Cars board check 40pin header (don't remember which pin, I can check if needed, this pin is falling down from 3.3V to 2.1V) to check N2 state on or off, then shutdown power in consequence.

I'm not sure what you exactly need, please be more succint as I am not in ease with long translation :lol:

edgedj
Posts: 8
Joined: Thu Feb 29, 2024 8:48 am
languages_spoken: english
ODROIDs: N2+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by edgedj »

zyssai wrote:
Fri Jun 07, 2024 3:13 pm
I'm not sure what you exactly need, please be more succint as I am not in ease with long translation :lol:
Ah thanks very much, To make my question shorter,
What are pins are involved to send the shutdown command from the GPIO module.

Would a single wire be enough to connect this to a pi5 GPIO pin

What is the state on that pin normally and what is the state when a shutdown command is sent? For example is it
Normally ground and a signal is made by it going to +3v or
Is it normally floating and a signal is made by it going to ground?

User avatar
zyssai
Posts: 1219
Joined: Wed Jan 27, 2021 6:42 pm
languages_spoken: english, french
ODROIDs: Odroid N2+ 4Gb
VU7C
Has thanked: 589 times
Been thanked: 245 times
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by zyssai »

edgedj wrote:
Sat Jun 08, 2024 10:17 pm
What are pins are involved to send the shutdown command from the GPIO module.

Would a single wire be enough to connect this to a pi5 GPIO pin
If you refer to tutorial, shutdownservice app execute shutdown when state of pin 8 change.
edgedj wrote:
Sat Jun 08, 2024 10:17 pm
What is the state on that pin normally and what is the state when a shutdown command is sent? For example is it
Normally ground and a signal is made by it going to +3v or
Is it normally floating and a signal is made by it going to ground?
State of this pin is inverted, I mean, low state required when OS is on, and a high state will execute shutdown. But no matter, the shutdown command can be executed just with a state change (0 to 1 or 1 to 0).

Hope I'm clear enough.

edgedj
Posts: 8
Joined: Thu Feb 29, 2024 8:48 am
languages_spoken: english
ODROIDs: N2+
Has thanked: 0
Been thanked: 1 time
Contact:

Re: GPIO'4'Cars, the way to drive your car with N2!

Post by edgedj »

zyssai wrote:
Sat Jun 08, 2024 10:37 pm
State of this pin is inverted, I mean, low state required when OS is on, and a high state will execute shutdown. But no matter, the shutdown command can be executed just with a state change (0 to 1 or 1 to 0).
Brilliant, yes that works! I've got pin 8 connected to a Pi GPIO pin and it's picking up the signal and shutting down. I've had to write a python script (wiringpi doesn't work on the pi5) to do the shutdown but it works perfectly well.

I also figured out how to get a switched 5v signal back to the GPIO 4 Cars so it correctly shuts the 12v supply off when the pi has shut down, I spliced into the 5v fan supply wire, this turns off with the pi so that's pretty much all I wanted from this, a very neat startup 12v which is way more stable than an ignition source and shutdown is triggered when I turn the ignition off for 3 seconds.

Here is the python script in case it's of use to anyone:

Code: Select all

import gpiod
import time

IGNITION_PIN = 21
chip = gpiod.Chip('gpiochip4')
ignition_line = chip.get_line(IGNITION_PIN)
ignition_line.request(consumer="Button", type=gpiod.LINE_REQ_DIR_IN)

ignition_off_count = 0
ignition_off_threshold = 3


while True:
  ignition_state = ignition_line.get_value()

  if ignition_state == 0:
    ignition_off_count = 0
  else:
    ignition_off_count += 1

  if ignition_off_count == 0:
    print('ignition on')
  if ignition_off_count > 0 and ignition_off_count < ignition_off_threshold:
    print('sleeping soon')
  elif ignition_off_count == ignition_off_threshold:
    print('shutdown')
    from subprocess import call
    call("sudo nohup shutdown -h now", shell=True)
    
  #print(ignition_state)
  time.sleep(1)
These users thanked the author edgedj for the post:
zyssai (Tue Jun 11, 2024 2:45 pm)

Post Reply

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 2 guests