Go Down

Topic: Change impulse signal to the straight signal (Read 4568 times) previous topic - next topic

nexusprime

#30
Apr 09, 2015, 10:13 am Last Edit: Apr 09, 2015, 10:32 am by nexusprime
question solved hehe:)

raschemmel

FYI, it is forum protocol (custom) to change the title of your original post to include the word
[SOLVED] (in brackets) at the beginning to let everyone know that:
A- the OP no longer needs assistance
B- Anyone with a similar issue can find the solution here
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

nexusprime

#32
Apr 11, 2015, 12:43 am Last Edit: Apr 11, 2015, 12:44 am by nexusprime
Unfortunately still have a problem.

I soldiered everything on the pcb and the problem is that Atitny85 with the code from this topic dosnt work. It just going HIGH when i send the signal and going LOW when i cut the signal, but when i take it from the pcb then everything going well.

I didnt send the whole project because problem is only in the first part.


What could be the problem? The attiny with that program is the Attiny 1 on the pic. The attiny 2 with other code working very well. I tried different chip, and recoded it many times.


CrossRoads

Quote
What could be the problem?
Lack of a schematic to help with troubleshooting.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

nexusprime

#34
Apr 11, 2015, 10:57 am Last Edit: Apr 11, 2015, 11:35 am by nexusprime
Lack of a schematic to help with troubleshooting.
Ok, here it is:


In case one when there is no 12V Stable input, the pulse input going via 5V stabilizer then in one way goes to the relay 1 but first goes via relay 2 and power up the magnet, and in the other way goes to the second Attiny85.

In case when there is 12V Stable input then the pulse 12V goes to the first Attiny85 and make the pulse stable, then the stable pulse gores to the relay 1 and power the magnet. In this case the relay 2 is in alternate position than on the image, so there is no any connection on the relay2 which is OK.

Now, the problem is with the case 2. The Attiny dosnt convert the pulse to stable signal. Just put out the same signal it get on input. This is all very simple i dont understand why the Attiny dosnt work.

Grumpy_Mike

First off you need to post the code that dosn't work.
Then you need to stop using a voltage regulator as a way of limiting the voltage pulses. That is a very bad idea because the regulator was not designed for that and you get all sorts of stability problems and responce time issues. A simple transistor will do what you want here.

nexusprime

#36
Apr 11, 2015, 12:03 pm Last Edit: Apr 11, 2015, 12:34 pm by nexusprime
This is the code:
Code: [Select]


void loop () {
 static unsigned long lasttime;
 boolean blinking_input = digitalRead(1);
 static boolean output;
 if (blinking_input == LOW)
 {
   lasttime = millis();
   output = LOW;}
 else
 {
   if (millis() -  lasttime > 1000 )
   {
   output = HIGH;
   }
 }
 digitalWrite(0, output);
}


According to the regulator issue. This is about 1 seconds impulses from the turn signal in car.
The 12V this is not a stable value. It is between 11 and 15V, because this is a car voltage.

Of course so far i am testing this with the laboratory power supply.

Grumpy_Mike

Quote
The 12V this is not a stable value. It is between 11 and 15V, because this is a car voltage.
Yes just put it through a transistor and then there would be no problems.

That code is wrong. You always put the output low at the end of every loop, you don't want to do that do you because then it will never hold up.

You should have posted all your code, who knows if you screw up in the setup function.

nexusprime

#38
Apr 11, 2015, 01:02 pm Last Edit: Apr 11, 2015, 01:11 pm by nexusprime
but this code works perfect when i put the chip out from the pcb and then put the power and the relay directly to the pins like this:


I am touching the VCC and the input(pin 1), and it holding the signal for a second or pin 0.

Why it is working in that configuration but on the pcb not?

Maybe that regulators is the issue ?

There is no rest of the code. There is another code on the different chip but it is not connected with the issue because it is even not in the pcb when i making the tests.

The second code work perfect when i make a CASE 1 from the schematic i uploaded.

It need to be a low state on the output if the signal will be cut for more than one second - this is a whole idea.

Grumpy_Mike

Quote
There is no rest of the code.
Then where is the setup function and the bit that changes the pin mode to be an output?

Quote
Why it is working in that configuration but on the pcb not?
I can't see any relationship between how you have wired it on your PCB from the schematic you posted and how you have wired it on that last photograph.

nexusprime

#40
Apr 11, 2015, 01:18 pm Last Edit: Apr 11, 2015, 01:22 pm by nexusprime
Ok now i am a little surprised, maybe i made something wrong with the schematic.

On the schematic:

1. The stable 12V input is the VCC on the chip right?
2.The pulse input should be the same as touching the VCC with the input(pin 1) because the VCC and the Pulse input have the same voltage.
3. The pin 0 should hold the signal and send it to the Relay.
4. The difference is the Schottky on the pin 0, 2 stabilzators and another relay but it is in disconnected state.

ups... sorry You are right there is no setup, SORRY!!

Code: [Select]
void setup() { pinMode(0, OUTPUT); }

void loop () {
 static unsigned long lasttime;
 boolean blinking_input = digitalRead(1);
 static boolean output;
 if (blinking_input == LOW)
 {
   lasttime = millis();
   output = LOW;}
 else
 {
   if (millis() -  lasttime > 1000 )
   {
   output = HIGH;
   }
 }
 digitalWrite(0, output);
}

Grumpy_Mike

Quote
1. The stable 12V input is the VCC on the chip right?
I hope not. The stable 12V goes through 7805 regulator to produce 5V and that is on the input of Vcc input of the chip.

Quote
2.The pulse input should be the same as touching the VCC with the input(pin 1) because the VCC and the Pulse input have the same voltage.
If you are just touching the input pin then when you are not touching the pin it is floating and can take on any level. I think what you are taking as working is just the charge on the input pin decaying back to a logic zero. On the photograph you have nothing connected so if you want to trigger it from just touching it to the Vcc line then you need a pull down resistor on this pin.

Quote
4. The difference is the Schottky on the pin 0, 2 stabilzators and another relay but it is in disconnected state.
The diode on your PCB will lower the voltage fed to the relay. What current should that relay take? And will it trigger off 4.5V?

nexusprime

#42
Apr 11, 2015, 02:59 pm Last Edit: Apr 11, 2015, 05:06 pm by nexusprime
First i want to thank You for helping me with this!

Yes of course, the 12V first go to the regulator and then to VCC.

The current is about 30mA with the 5V, it will also work with the 3V at 17mA or more of course.


You are right...this is not effect of the code that it holds it for a second.

Now i added one 0 to the time in the code and i see only the time for detect the signal rise but the output will be cut when i take the input out. Can the code be corrected the way it will work on that pcb?

I think the problem with this code is a fact that even very small voltage will set the HIGH value. Probably i should use the Analog input and set the limits ?

nexusprime

I will say just two words... Pullup Resistor -_-

Grumpy_Mike


Go Up