Maker Pro
Maker Pro

Help with circuit design, radio receiver/car entry

Hello I is new here, need alittle help with programming Atmel micro controllers, or Audiuno to pre start my cars engine to warm it.

I am trying to make the right program/ switch to receive 3 presses from my cars keyless entry lock, and then activate a relay sequence. And other settings accessible by remote press combinations. But my programming ability is not this good yet.

So basically designing a switch receiver which can tap into my cars existing door lock receiver in the car, and after 3 or 5 pulses activate a sequence. Pressing it once will do nothing but actually unlock the doors as usual.

That is all I need to design for now and everything I have done so far is complete. hopefully someone can help me. I can see the programming shouldn't be hard level, but unfortunately I need to learn how this works from expert.

Also sorry if I've posted in the wrong section, I also tried searching for similar threads but had no luck..

peace
 
Is it the Arduino script you require or the hardware aspect as well? Have you found a suitable point at which the keyless entry signal may be tapped from an in car system?

Writing an Arduino script to identify 3/5 pulses in succession will be no problem and I will be happy to provide it.

By: "everything I have done so far is complete", what have you done so far?
 
Hello Lavaguava, thanks for helping me, appreciate it

I have the hardware Auduino chip/board. Also AVR ISP programmer with a few AtTtiny 12 and atmega8 chips

I need to figure Out how to write the program for it also find right chip to complete the tasks.

The pulse receiver simple. But after the pulses are received I want the car to start the engine. The program has to recognise a few sensors before allowing engine to crank.

I have places reed switch/ magnet setup on the gear lever so they are N/O when car is in neutral (manual) and closed contacts when in gear. Obviously if the car is in gear, and the reed switch sensors are closed, it overrides the start sequence and does nothing. I want to include another but for handbreak check on. I can find and identify the ignition crank wires myself , I'm an electrician, I just need little help with programming logic

I have not yet located the cars keyless entry receiver but this will be very easy, and identifying wires that have press button power also

Sorry for the long posts but I see no other way. I'm being very thorough, I'm a very thorough little one
 
Thorough is the best, far better to be thorough than not provide enough information.

I have attached the Arduino code, I am assuming pins 12 and 13 are both available. As the process is simple and there is little to be done, the program uses polling rather than interrupts. The Arduino will be able to carry out your task. The code should take five pulses on pin 12 and activate an output on pin 13, if the pulses are more than 1 second apart, the counter resets. I am not as to how much knowledge you posses of Arduino, if any then take a look over the code and see whether you think it may fulfil your aim.

If further information is required I am happy to provide.

I hope this helps,
 

Attachments

  • succesive_pulse.ino
    778 bytes · Views: 131
Once again, many thanks

I have a very basic knowledge of how coding language works, ham in the process of slowly learning. I've done programming before through AVR studio to breadboard connected chips, but never written code. My code understanding skills were rusty 2 years ago but I'm willing to learn the login through projects like this.

The arduino chip is an ATmega328 right? So once programmed I can remove it from the Audino board and solder to my circuit.

Is it possible to add extra outputs on the other free ports with different pulse sequencing? Like if I copy and paste your code below the closed brackets, remove the headers and change the 5 pulse to 3, and the output to say pin 4? Not sure if what I'm sayings right but code should work same way I guess

One thing that I'm not sure how I will go about yet is the ignition connection. I was thinking of connecting the correct start wires through mosfets and the pin outputs of the chip. Or just activating an already made eBay bought remote start circuit, and subbing in my arduino circuit to just switch it on.

As you may know the ignition needs to contact a few wires until the car starts, then cut power so the starter motor isn't grinding. I think I will purchase an already working system for ease and Safety to my car.
 
Last edited:
Correct, the chip from the Uno is an Atmega328. The chip can be removed from the board, however requires an external crystal oscillator (There are plenty of tutorials showing you how to do this) and a 5 volt regulated supply.

Yes, the output pin can be changed along with pulse quantity. To change the output and input pins, simply change the numbers next to the variable to the desired pin. To change the amount of pulses required, simply change the conditionals, from five to x. Change both occurrences, one is to be found in the bottommost if statement and the other in the main while loop. Additional outputs with different pulses required is also addable, it sounds as though you have the right idea as to how to add them. If you are unsure, describe exactly the amount of pulses and which pins to output to and I can update the program for them as well.

FETs are an excellent choice as they are solely voltage controlled, thus they will not draw the much needed current away from an existing system.

The system from which you are drawing the pulses does receive the real time ones, does it not? The program is designed to work with key press timings that humans make.

What you have sounds good so far, the ignition side is a little past me, I am not yet old enough to drive. But it sounds as though you easily know enough to handle that side of things.

This is going well.

I hope this helps,
 
Awesome, so would this code work on another Atmel chip like the ATmega 8 ? So that it dosent need a crystal oscillator. If not I will just proceed with one

Yea the pulses are live from human remote pressing. I will press the lock button on my car 5 times and this circuit will activate. After messing with car today I noticed a few things..

How can I increase the time the code needs between pulses from 1 second to x as the car clicker pauses for about 2 seconds between clicks by itself.

And a question about the output. Once the circuit receives the 5 pulses and outputs it's power to pin 13, how long is the power outfitted for? How much volts are output, 5v?

Thanks again
 
i guess if i change the - if(state < 666) it will wait for about 1998 milliseconds (about 2 seconds) right before outputting to pin 13.

what code would i need to add so that when the power output by pin 13 is switched on, it stays on for a certain time period
 
Sorry for taking a while with my reply, tied down with homework.

The code would not function on an atmega of another type, if you were to purchase the tiny AVR programmer from Sparkfun and downloaded the arduino software core provided, it would be easily compatible with the attiny85 with pin names changed. If a core can be found for the chip in question, then it would be compatible, but in this situation I would stick with the 328.

That is good that the pulses are live, no code edits required there.

You are very correct, you do increase the conditional that checks state to increase the time. Waiting for 666 would not increase to 1998 ms, you would need to wait for 400 reps. If the key auto pauses for 2 secs, I would increase the delay to 3 secs.

200 state = 1 second
200 * 3 = 600 = 3 seconds

Very well spotted, I had not inserted a delay to determine the output time, nor had I set it low afterwards. Change the variable output_time to the ms you want activation to occur for. I have set it to a quarter of a second.

Hope fully the code is now fully debugged.

If your Vcc is 5 volts, approximately 5 volts will be the digital output level.

If you have any further questions, do not hesitate to ask.

I hope this helps,
 

Attachments

  • succesive_pulse.ino
    825 bytes · Views: 62
Hey i have compiled the code on Arduino and then uploaded to my UNO board.

then i connected an LED to ground and the + to pin 13.
with a jumper cable i conected 5v to one end, and i touched pin 12 5 times quickly and slowly to test it, but nothing happened?

i pressed the reset button on the board, and the LED i connected with the SMD LEDs all flashed as it reset.

i changed the numbers on your code from 5 to 3 (i want 3 pulses now)

where am i going wrong??

Ive also purchased 2 ATmega328 chips with 16.00x oscilators to program and solder to my board. but i need to get it working first!
 
My apologies, it was my buggy code, I had made it far more complex than it needed to be, I have reduced the amount of code required greatly.

To change the amount of repetitions change the two conditional occurrences.
 

Attachments

  • succesive_pulse.ino
    793 bytes · Views: 58
problem may be with me because when i try to upload either of your codes i get the error message:

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30

ive searched on the web about fixing it and still had no luck. the board is configured to the right port, ive tested it and uploaded a flashing led program and the board takes the code, and flashes perfectly.

again after confirming this, i started a new project, pasted your code in, and uploaded. all i received was this error message.

Question, do i need to connect anything other than the USB A & B cable to the Arduino in order to successfully upload your code?
i ask this because all of the other programming ive done is with an AVRISP mkII and i was required to connect jumper cables and power to a microcontroller on a breadboard.

Obviously the ATmega 328 already has this on the Arduino board, However there is a 6 pin connector labeled ICSP, does my AVRISP go here? there are other connectors labeled AO A1-A5, an AREF pin and a 4 pin connector up on the top right.
are they used to connect jumpers between the pins of the ATmega 328 to allow programming certain things?

as far as my knowledge on programming goes, i cannot see a reason your code wont work..

Thanks
 
Ok sorry about my complete incompetence on the Arduino side but i dont know if ive fixed it and am using your code wrong. or if i havent fixed it and im right about being wrong

i have compiled and uploaded your new code successfully to the UNO board with no errors.

When you say pin 12 will receive a series of pulses, do you mean a +5v input, 5 times to activate the output on pin 13?
i have attatched an LED to a breadboard with the ground and + to pin 13 like last time, and still nothing? i touch pin 12 to 5v 5 times faster than 1 second and nothing happens on the output... Puzzled is the word for my reaction

Appreciate the help so far
 
The error code you are receiving is a problem with your hardware, a desynced system, from what I have read, is nigh impossible to fix. You will require a new Arduino Uno board. I would suggest you stick to the inbuilt USB capability of the Uno board right now, it is possiblt to get an ISP programming wire which plugs into the Uno's ISP male header, but this is opening the door to more errors. If you are the begginner you claim to be, get a new board rather than attempting to bypass the problem.

For standard use, you only require a USB cable. All uploading is done through the USB A to B cable. When uploading you should see the status LED blink rapidly.

This is going to be difficult without seeing what is going wrong, it could be a great number of things.

Firstly, the editing can come later, once any errors or bugs in the hardware and software have been ironed out this will be easy. Potectial Errors:

  1. You should use a momentary push switch rather than a bare wire as this is far more reliable. There is only a small amount of time for debounce, the wire can make small contacts with the target before and after your perceived touch time, this can lead to errors. So first off try this.
  2. Additionally, you MUST use have pull down resistors. When you detach the wire you may believe that you have disconnected any voltage, when in fact you are leaving the input floating. I made this exact same mistake when I began electronics, KrisBlueNZ corrected me on this one. For a 5 volt system use a resistor anywhere from 4K-6K (That is what I use) connected to 0 volts from your input pin. After this include the momentary switch, which when pressed applies near 5 volts. See the attached file.
  3. If you are getting the error you mentioned in #12, then it may appear that you are uploading new code, when in fact you are not. Of course the above two errors, specifically the second are far more likely. Check them first.
Once these issues are resolved, I will again review my software. But I think issue no.2 is most likely your problem.
 

Attachments

  • pull_down_resistor.jpg
    pull_down_resistor.jpg
    855 bytes · Views: 91
I have gone through what you said and made some changes, still with no luck...

A 5k resistor was wired to pull down to ground with a momentary push button and pin 12s input.

Testing there is power, and continuity between my connection with multimeter confirms correct connection.

Before posting I reuploaded a blinking led program to confirm functionality again with success. I then uploaded your code and pressed the push button 3 times rapidly with nothing... I no longer have the error message when uploading code

This is really bugging me! Can't understand why the arduino won't go
 
After reviewing my Arduino code again, I am absolutely confident that there is nothing wrong with the software. There must be something that we are still missing.

Are you absolutely sure that you attached the pull down resistor directly to the input and included the momentary push switch after the pull down connection? This can be an easy mistake to make for some.

I opened the version I sent you in the last post, that was the wrong version, that version did not wait after receiving a low, making the program skip pulses. I have attached the correct version, additionally more debounce time has been added. Remember that 5 pulses are required, not three, try as many variations as you can, not just fast and slow.
 
I have connected the resistor/ switch circuit exactly as your attached diagram.

Pin 12 goes to the resistor and one side of the switch. Other side of the switch goes to 5v. And other side of the resistor goes to ground

I don't think you attached the updated code in your last post. Are you able to upload the most recent debugged code in your next comment?

Hopefully I can find the source of the problem. I've gone through trouble shooting every variable on my circuitry, the only thing I can't check is the programming. Reading through the code makes a bit of sense to me. Once the circuit works I plan to use the code to learn the structure and functions. Then solder it to a very large pcb which I will add many more programs/circuitry to create a very hi tech smart hub for my car.

Really do thank you for help so far man
 
Ohk that's fine im sorry for being persistent!

I am still playing around and searching on why my circuit isnt working, starting everything from scratch multiple times.

Really appreciate your help so far Lavaguava! Legend
 
Top