slydog75
Posts: 3
Joined: Fri May 24, 2019 12:39 pm

How Hard would this be?

Fri May 24, 2019 1:01 pm

Hello,

I"m new to the Pi and, while I studied a bit of programming back in college (VB, a bit of Java and JS) at this point I'm basically starting from scratch. I have a kit car that I've built and I need to install an Idle Air Control Valve. HOwever, I currently have no way to control it. What i need to do with the Pi is have it power up a relay whenever I first start the car, then close it after a minute or so. So it would need to sense that I've started the car (basically just sense the state of a switch), power up the relay, then power down the relay after a set time. What do I need to make this happen and would it be done with Python? How much Python would I need to learn to accomplish this?



Thanks.
Last edited by slydog75 on Fri May 24, 2019 3:15 pm, edited 1 time in total.

Aydan
Posts: 667
Joined: Fri Apr 13, 2012 11:48 am
Location: Germany, near Lake Constance

Re: How Hard would this be?

Fri May 24, 2019 2:58 pm

A pi really is the wrong controller to use for this. An arduino would be the easier solution, if you want to go the controller route.
Also you could make the relay control engine temperature dependent.

As for doing this with a Pi, you'll probably boot the pi by activating the ignition. So you'll have to wait to sart the car until the Pi comes up (may take up to 30 seconds with no gui, depends on the random access times of your SD card, A1 cards improve this.)
Then you could have something as simple as a bash script polling for an input activated by the starter switch, activate the relay, wait for a minute, deactivate the relay, exit.
This of course can be done with any language.

I'd start this with a oneshot systemd unit.

You'll definitely need external circuitry to protect the Pi (or any other controller), the environment in a car is quite harsh.

Personally, I'd use a temperature controlled relay.
What works even better is a temperature controlled analog control of the valve, so it smoothly changes when the engine warms.

Regards
Aydan

slydog75
Posts: 3
Joined: Fri May 24, 2019 12:39 pm

Re: How Hard would this be?

Fri May 24, 2019 3:14 pm

Hmm.. I hadn't thought of the issue with boot up time.. That's not going to be acceptable. I haven't looked into the Arduino at all, does that solve this issue? A temperature controlled relay would help but wouldn't fully solve my issue as the car has a tendency to stall for a few seconds on start up even when it's warm.

A bit more background.. I'm using an aftermarket ECU to control the engine but it only has 4 outputs and all 4 are already in use to control the radiator fans, intercooler fan, fuel pump and tach.

Andyroo
Posts: 3280
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How Hard would this be?

Fri May 24, 2019 3:19 pm

Given that you would not be connecting to WiFi or an Ethernet network, boot time would be faster than your cars internal system (esp if it’s my Renault) as the start code would be minor and you would hit the loop in very few instructions.

I would also think they are tougher and be able to survive the power problems in the car better...

It’s easy to add watch dog circuits on as well - you where going to add one in weren’t you :lol:

Edit: C is the best way to go - MicroPython is coming up but this code code run on an ATTiny 85 with no fuss (in fact 6 IO pins is a bit overkill for you)
Need Pi spray - these things are breeding in my house...

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22684
Joined: Sat Jul 30, 2011 7:41 pm

Re: How Hard would this be?

Fri May 24, 2019 3:28 pm

I'd agree with the first comment, I think an Arduino would be better option. It's a very simply requirement, so a microcontroller seems the way to go.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

slydog75
Posts: 3
Joined: Fri May 24, 2019 12:39 pm

Re: How Hard would this be?

Fri May 24, 2019 3:53 pm

Thanks all, sounds like I need to find an Arduino forum then!

Andyroo
Posts: 3280
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How Hard would this be?

Fri May 24, 2019 4:00 pm

slydog75 wrote:
Fri May 24, 2019 3:53 pm
Thanks all, sounds like I need to find an Arduino forum then!
Byebye :cry: :cry: you are welcome to come back at any time :D

Good place to start is https://forum.arduino.cc/index.php
Need Pi spray - these things are breeding in my house...

Return to “General discussion”