Arduino does not see the external current, what's wrong?

So far, that a novice in this area, do not blame me. Make a "tachometer" for the car.
On the arduino you plan to feed al. current with high frequency (approximately 4 signal one turn dvigatelem and up to 8,000 rpm*, i.e. somewhere 533 signals per second).
First wrote a function that ate all the CPU time and checked each step of the signal status on the digital port and add 1 to the counter if the signal was varied from 0 to 1.
Just a couple of minutes ago came across the function attachInterrupt, rewrote everything with it and everything seems to work great. But the problem lies elsewhere.

1. Since in the car walks current 12 volt had to make a "Converter" from 12 to 5 volts. Once I figure out how to do it right, necessarily come off their hands, but now it's 15 simple diodes and 1 transistor. It turned out 4.8 volts at the output, which is quite suit me, but such an abundance of the diodes I have a problem and asking for your help, as all correctly to organize?

2. For tests (and not to burn the computer) from an old phone charger and half a usb cable for arduino made Board (connected the 2 wires, + and -). It worked, but when connect from charging, the arduino at all does not see a signal on the pin. If you turn back to the computer, then everything works fine and the signal it recognizes. Just read again the documentation on the Arduino and noticed a note "author External power (not USB) can be supplied via an AC/DC (power supply)", i.e. he meant that it is impossible to supply power not from the computer to the usb port?

You know, a seasoned "techie" would long ago have taken this poor Arduino and put in a corner, but I just started to learn it and I hope for your help)
6eKbU260JMU.jpgHZVViqfN1lk.jpg
July 9th 19 at 10:34
4 answers
July 9th 19 at 10:36
Solution
1. Linear regulator, e.g. 7805, the circuit is very good. simple. Just in case the radiator slapped.

2. The signals from the sensor to the optocoupler tipo 817.
Through the led of the optocoupler will be held 12-15 In the signal from the sensor (don't forget resistor in there limiting the current to around 20 mA) and ground cars.

And the transistor of the optocoupler is connected through a pull-up resistor to +5V and to remove from it a signal.
Bonus get galvanic isolation.

About "does not see the signal", if you can shemku distribute. As an option, you just need to connect common wire from the sensor and Arduino. Although from the text I don't fully understand what is happening there.
https://pp.vk.me/c636628/v636628361/bf07/HZVViqfN1...
https://pp.vk.me/c636628/v636628361/bf11/6eKbU260J...
The red wire is currently connected from the computer power supply 5V
The power supply was never intersects with the power the Arduino, what is currently wrong in the connection diagram? - Jamel5 commented on July 9th 19 at 10:39
: what is this wire?
If you have 2 different source, then they need to connect common wire, since the dimension of the building should go on a certain point and not through the air. - caden_Wintheiser commented on July 9th 19 at 10:42
This wire is currently "simulates" the flow of current from the crankshaft. Ie I switch on and off current supply from the power supply. You propose to connect it to the positive side of Arduino with the pin?
And by the way, now checked when removed all the diodes and all the stuff that "lowered" the voltage from 12 to 5V and connected directly to the power supply to 5 volts then it worked) - Jamel5 commented on July 9th 19 at 10:45
minus of the power supply minus the Arduino needs to be shared.
Generally it is better to take attopeu and you will be galvanic isolation sensor circuit and a controller.

And Yes, it is better to forget about resistive dividers for good.
Voltage car 11-15V rides. :) - caden_Wintheiser commented on July 9th 19 at 10:48
: https://pp.vk.me/c626320/v626320108/f51c/hxzqPh34Q... - caden_Wintheiser commented on July 9th 19 at 10:51
So that's it, ie get the optocoupler works as a key, and in the presence of a current left side of the diagram that you sent it closes the right part?
Maybe I misunderstood, but it turns out that the pin goes all the time 1, but when triggered the circuit goes to 0.
Ie we believe in this case the number of "obrisani" per second?
Or I not correctly understood and still naoborot? - Jamel5 commented on July 9th 19 at 10:54
: Yes, you can configure the interrupt as rising rising front and a descending falling, depending on Your goals.
If you need to that without decoupling, it can also nakidat quickly picture. - caden_Wintheiser commented on July 9th 19 at 10:57
: Yes that is enough, you gave a great option, I didn't know before about the optocoupler, thank you!) - Jamel5 commented on July 9th 19 at 11:00
July 9th 19 at 10:38
You need to study to start with the fact that 12V is not current and the voltage.
Need to learn things like Ohm's law and voltage divider, in the real world there is no need 15 diode nor the transistor, enough resistor and Zener diode at 5V
On USB power you can apply, but only a steady 5V and not confuse the polarity for an external source of 7-12V there is a separate output

In short, put your Arduino while it is still showing signs of life and turn to the study of the fundamentals of electronics
July 9th 19 at 10:40
1. A voltage divider
delitel_napr.gif
And in this case one of the outputs to attach to the negative, and the second to use for the intended purpose (pin)? - Jamel5 commented on July 9th 19 at 10:43
Found another skeleton, she may be more complete?h4e.ru/images/equipment/Delitel_napryazeniya/Chema... - caden_Wintheiser commented on July 9th 19 at 10:46
In principle, more or less sorted out, thanks)
cxem.net/calc_tmp/divcalc/a8c605f088b5506b8321f4a6... - Jamel5 commented on July 9th 19 at 10:49
July 9th 19 at 10:42
1. Apply a simple voltage divider pair of resistors.
2. If the device from which the signal is not powered from the same source as the Arduino - connect the common wire whisker-VA, and Arduino.
It is possible and on USB to give power (poverbank, for example), the main thing - not to exceed 5 V.
3. What signal and what Converter?

Find more questions by tags Arduino