+86 400-003-5559 CN


Ask Hackaday: How Do You Convert Negative Voltages To Positive? | Hackaday

tags100uf 50v capacitor

I have a good background in high voltage. For me, this means more than 10,000 volts, but I still have a lot of blanks in the low voltage area where the RC control board and H bridge are located. When I was working on the first real robot BB-8 robot, I stumbled upon a design board that was used to convert the different polarity of the RC receiver board to a positive voltage for Arduino only.

The question today is how to convert a negative voltage to a positive voltage?

In the end, I came up with a viable method, but I'm sure there is a more elegant solution, which may be an obvious solution for those who understand the low-voltage field. Next is my journey to present the committee. My work has worked well, but it still keeps me entertained. I would love to see the skills and experience of the Hackaday community applied to this simple but confusing design challenge.

I have an RC receiver taken from a toy truck. When it is on a truck, it controls two DC motors: one for front and rear driving, and the other for left and right steering. This means that the motor needs to be told to rotate clockwise or counterclockwise. To make the DC motor rotate in one direction, you need to connect the two wires in two ways, and to make it rotate in the other direction, you need to reverse the two wires or reverse the polarity. It is common that there is no output line inside the RC receiver. This is the method I found difficult, as shown below.

I did not use the RC receiver on the toy truck. I extracted it from the truck and used it to control my BB-8 robot. My BB-8 robot has two configurations

, But more widely known are fuel tank drives or differential drives (see illustration). The two wheels rotate in the same direction relative to the robot, and the robot moves in that direction. Reverse both wheels and drive in opposite directions. Rotate the wheel in the opposite direction, and then turn it on.

The motor in BB-8 is a drilling motor, controlled by two H bridge boards. Arduino performs pulse width modulation on the H bridge board for speed control and controls which direction the motor should rotate in. Finally, the RC receiver tells the Arduino what to do. However, a conversion board (the subject of this article) is required between the RC receiver and the Arduino. Please note that Arduino is also necessary to counteract when the BB-8 robot swings and synchronize the sound with the movement, but it is not resolved here.

Since there are two motors and each motor has two directions, the RC receiver needs to control the four pins on the Arduino to make the two drilling motors behave as follows: motor 1 / clockwise, motor 1 / counterclockwise , Motor 2 / clockwise, motor 2 / counterclockwise rotation. Any voltage that the receiver applies to these pins must be relative to Ardunio's ground.

That's the problem. The Arduino expects a positive voltage relative to ground on all these pins. Therefore, I need a way to map the two sets of motor control lines of the RC receiver to the Arduino pins that only require positive voltages, which may have positive or negative voltages at both ends. Remember that these RC receiver wires are not common inside the receiver.

Now, please remember that electronics is my general interest, except for the courses we teach in high school physics, I am self-taught. This means I have "understood", but a lot of my knowledge depends on the projects I have completed. So I have gaps in knowledge. I have never changed a negative voltage to a positive voltage. It sounds simple. However, searching online did not help. The closest I got was in the two old posts on the forum, the answer was "It's easy to do. I can do this with a resistor." But there is no further explanation, at that time I didn't ask myself anywhere problem.

Instead, I came up with my own method, first using only one set of wires from the RC receiver. The wires from the receiver are blue and brown, and can be positive or negative or counterclockwise depending on how the receiver is told to spin the motor. This means I need two diodes to create two possible paths for the different polarities the brown wire may have: positive or negative. Then, I added a battery to a negative path to make it positive.

Next, I placed a PNP transistor between the positive terminal of the battery and the receiver. In the absence of a signal from the RC transmitter, the base of the transistor is extremely negative with respect to the emitter, but not enough to turn on the transistor. This is because the negative terminal of the battery is connected to the blue wire of the receiver, and since there is no signal from the transmitter, the brown wire is also at the same potential as the blue wire, and the battery is negative.

The idea is that when the transmitter sends a signal to make the brown wire negative with respect to the blue wire, it will become more negative and turn on the PNP transistor. Then, a positive signal will be transmitted from the battery to the Arduino through the transistor.

The most obvious problem is that the Arduino wants to see 3 volts to register as a HIGH input, which means that the battery must be at least 3 volts, so even if there is no signal from the transmitter, the voltage to the transistor is -3 volts and should not be turned on Turn it on in case of

Therefore, I immediately thought of using relay instead. I will use the current flowing through the negative path to power up the relay, thus closing a switch completely independent of the RC receiver. Arduino has a 5V output pin, so I made the switch to close the circuit between the 5V pin and Arduino pin 7 to provide the required positive voltage to pin 7.

The 1 in the circle in the schematic shows where I want to place a resistor to limit the current flowing through the relay coil. However, I have been trying to use resistors as low as 4.7 ohms, but the coil does not have enough current to close the switch. Without resistance, it can work with a current of 70mA. The rated voltage of the coil of the relay is 3V/120mA, so I left it.

Using a relay may seem laborious, but this is the only solution I can think of, and I already have a relay.

The next step is to add a second relay and do the same for the second set of wires from the RC receiver of the second motor.

But this behavior seems to be sporadic. Remember that there is a complete double H-bridge circuit also connected to the Arduino ground. I have worked with relays many times before, and the RC receiver comes from a commercially produced functional toy, so I have no reason to doubt. On the other hand, I have made the H-bridge circuit from scratch because I have mastered most of the parts and I am still new to H-bridge and MOSFET. Therefore, at first I spent two weeks of free time thinking that my problem was with the H-bridge and drilling motor. I’m pretty sure that all of us have experienced the same blindness, and believe that the most likely culprit is the part you are involved in.

But at some point, I disconnected the H bridge, only tested the RC receiver circuit, and observed the voltage on the Arduino pin. At the same time, I turned on the two "motors" in all combinations in both directions (although there was no connection at the time Any motor). The only strange behavior I saw was when I turned on the motor in the opposite direction.

Note that in the diagram, I connected the two blue wires from the RC receiver together. Until then, I have assumed that the blue wire is common inside the receiver, and only the brown wire changes from positive to negative relative to the blue wire. From my behavior, it seems that both wires are switching polarity, possibly around other internal common references.

Therefore, I added a third relay on one of the positive paths of one of the set of wires. This means that it is no longer necessary to ground the corresponding blue wire, so that the two blue wires of the receiver remain separated. Please note that I did not put in the fourth relay for the remaining positive path, which proved unnecessary. At that time, the circuit played a big role, and it continues to do so.

So I asked, is there a better way to convert the RC receiver output into something that Arduino can use? Relays require power, so it would be great if there is a solution that does not require any additional power. My relay solution seems to be in the early 1900s. Maybe this is a good solution after all, but it is only one of many solutions. Let us know in the comments below.

I was asked in the comments to provide high-resolution photos of the RC receiver circuit board. The embedding is too big (don’t want to slow down the phone users), so

(Warning: 5MB).

Your chart is more advanced than the one I used before, but I am curious why you don't just choose a simple motor speed controller? Those of us who have developed R2-D2, and some who have built BB-8, just use size engineering ESC, and most of what you are talking about can be processed.

Usually, when I start all this, I am not familiar with ESC. Moreover, I also have to synchronize the movement with the sound through the Arduino (for example, when rotating in the field, the children who usually sway around translate, so I want it to make a sound when the rotation starts). When the droid stops, the Arduino also performs speed control to handle the swing. I am new to ESC, but based on my reading, I did not see how they can be used with Arduino.

For BB-8, this thing has been more or less solved and open sourced by people who 3D print more than 90% of his figure. James Bruton / XRobots. Search for it on youtube and you will find links to all his codes.

To get a simpler/universal "fuel tank"-like control (ie -R2, no need for inertial monitoring in complicated places), please check the SHADOW and Padawan systems under the electronic sub-forum on asromech.net.

Yes, James did a great job. There are also some good shaft drives. One of the open source is Ed Zarick

. But making BB-8 is not what I really want to do. I am more driven by engineering challenges, so following other people’s verbatim records is not of interest to me (plus James and I started at about the same time. It took me longer.)

In my opinion, the RC receiver already has two H bridges to control the electric motor of the toy truck. Therefore, I am not sure why I need to make things so complicated.


Because the goal is to convert a "normal" drive to a differential drive.

In an article on Hackaday: "I'm not sure why I need to make things so complicated."

Made me laugh

If it were me, I would not use the analog output of the receiver. All you really need is the RF deck in the Rx. You don't need a decoder or powertrain, so I will look for the original pulse sequence from the RF card socket to the decoder, then send it to the Arduino and decode it there. This also allows you to perform any mixing, fault protection, etc. you think is suitable for the application.

A few years ago, I did something similar in a cheap fixed-wing remote control toy. It uses Elan uC, I found a pin compatible AVR, you can plug it into the circuit, and then write your own decoder.

It all depends on the comfort level of using low-level firmware. I don't know what the Arduino environment has, as I wrote for the AVR series in C and Assy.

I am working on a broad assumption that the original receiver lacks any balancing or anti-sway logic, and you may be using an upgraded motor (the original receiver unit may not be able to drive reliably). Basically, you only need its input, so you don't have to build your own remote circuit. First of all, please check whether the battery is grounded and any output has the required voltage when driving this output-one of the two wires means "left" and "right", the other means "positive" and "when either pair Relative to the battery ground when it is positive, "reverse". Don't read both pins together-just connect one pin to ground. If that's fine, then you only need to connect the receiver ground wire to the Arduino ground wire You can use it.

The next simplest method is to turn on the RF receiver, isolate the two half H-bridges inside (tracing back from the output wiring), and then connect IN to INPUTS. Drive the Arduino common receiver power ground, no matter which H bridge input is high, it will define the motor direction. The premise is that the receiver unit can be opened, and no ASIC (h-bridge integrated inside the receiver IC chip) is packaged or used, but this is not the standard for cheap toys.

Also, in the answer below, it is mentioned that the receiver runs 5V, while Ardunino runs 9V (minimum 7V), if you bypass the voltage regulator on the Arduino (ie, don’t use the input power plug, but set the regulated 5V Insert the GND and +V headers), you can provide the receiver and Arduino at the same time from the same power supply. Another benefit is that your device will have a power switch.

In addition, as long as the receiver does not consume too much power, you can power the Arduino through its current input, and power the receiver through the +5V and GND of the Arduino connector (to achieve most of the juice in the receiver battery) The configuration was originally intended to be used For the drive motor). Speaking of which, how do you power the motor? I hope it is not directly disconnected from the Arduino I/O pins?

The motor is powered by the second H-bridge through which Arduino sends PWM. This is powered by drill batteries, one for each drill motor.

Your assumption is correct. I need to use Arduino to implement anti-swing logic, because the BB-8 robot will swing a lot when it stops, and the start of the motor is also a signal for the Arduino to make a sound.

I assume you use the same power supply for the receiver and arduino? If so, use common ground as a reference and use a diode/pull-down resistor on each "motor" wire. When powered by a battery, the H-bridge does not generate negative voltage, it only reverses the direction of current through the motor.


This is very. If the receiver and Arduino can run on the same power supply, it should be possible to read the H-bridge output using a pull-down resistor. If the receiver has its own H-bridge, it may not output "negative voltage", but just swap which motor output pin is VDD and GND.

Therefore, parallel bridge rectifiers can solve the problem.

Unless the receiver implements some PWM by itself, the solution should really be that simple. The H-bridge connects the output to GND or VDD. It is not creating a "negative voltage", but to change which end of the motor is connected to the same "positive voltage". As long as both chips use the same power supply, you need a pull-down resistor and a digital reader.

A small capacitor in parallel with the resistor will be responsible for the PWM signal. Even better, you can use the 4 analog inputs of Arduino to read the PWM equivalent analog value!

Sadly, their consumables are different. The receiver uses 5 volts, while the Arduino uses 9 volts (7 volts minimum).

You can still connect them to the ground.

As long as the two power systems are not connected, the H-bridge output will float and display as an AC signal, and you can connect it to any voltage required on the Arduino circuit. If you connect one H-bridge output to the ground of the Arduino, then you will get negative and positive voltages from the other output-however, all other output channels depend on the state of that channel.

Conversely, if you connect the power ground of the receiver to the power ground of the Arduino, all H-bridge outputs are switched between 0...+5V relative to the Arduino.

In addition, since you only use the Arduino to control another H-bridge, what you actually need is to add a push-pull amplifier stage to the output channel of each receiver. You can add other H-bridge chips, but you can skip the process and just add some powerful FETs with appropriate current handling capabilities.

GND is the receiver's ground, and V+ is the ground you want. If V+ is greater than the receiver output voltage, you need to use a simple level shifter between the receiver and the push-pull buffer, because the input signal must swing from GND to V+ to drive the FET correctly.

Possible warnings are that the receiver’s H-bridge does not have enough dead time between switching, and/or your level shifter has reduced the speed of the FETs, so they all stay on and start to heat up during the crossover period . In that case, you do need another H-bridge chip, but you still don't need an Arduino because you can treat the receiver output as a logic level signal relative to the receiver power ground.

Moreover, you also need to add freewheeling diodes at both ends of the FET so that the induction kickback of the motor does not put too much pressure on them.

This simple buffer is suitable for voltages up to about 24 volts. In addition, you cannot drive the FET gate from the common input because the voltage difference between the gate and the source exceeds the FET's specifications and may damage them. For higher voltages, you need separate high-side and low-side drivers.

This is a circuit simulation of a CMOS inverter, which is basically a buffer

Please note that when you implement a level shifter with a pull-up resistor to V + and a level shifter with an NPN transistor for pulling down to GND, it is also an inverter, when the signal is inverted by CMOS again When the inverter is inverted, it will output the correct path.

This ^^^^ is more or less the correct answer, but it can be simplified a bit. In fact, many "dumb" H-bridge chips are just dual half-bridges (basically introduced here), which is exactly what you want because it has built-in dead time/bootstrap circuitry. The built-in H-bridge of your RC driver will produce an output voltage of 0-5V (because you are talking about its power supply), so these voltages can be fed directly into the half-bridge control input. Again, as others have pointed out, this is all out of common ground. Unity.

Dual half bridges usually don't have cross protection or current limiting options because they are dual half bridges rather than full bridges-they are assumed to operate independently as independent push-pull buffers, so the state of one should not affect the state of the other.

It looks like it might be the solution. I did some further tests with an oscilloscope last night, and it seemed that grounding the negative of the battery on the circuit board (it turns out that the negative of the battery on the circuit board was marked as negative) actually caused the output to be positive relative to that ground. So it looks like connecting it to the ground of the Arduino and adding some current limiting resistors and pull-down resistors are all necessary, unless I still lack anything or encounter another problem.

The BTW receiver does not implement PWM. The TX/RX has no speed control. The transmitter appears to be capable of speed control, but it is actually an on/off switch.

I do need Arduino. It also uses the motor to counteract the robot's swing when it is stopped, and in some cases plays a sound when the motor is turned on (for example, when the robot is spinning on the spot, like I do when I stare at the robot when I have children) it).

The only reason the Arduino needs 7+ V is that you power it through the built-in voltage regulator, which provides 5 V that is actually depleted. You can directly power it by connecting a 5 V power supply to the 5 V pin instead of the Vin pin. Even if you warn on the Arduino page, it is absolutely safe, as long as your power supply is actually 5 V and you disconnected the power when you plug it into your computer via USB (if not, it will connect two different voltage sources , Not a good idea).

I think the light release agent can solve two problems well. One problem is the positive and negative problem, and the other is voltage level conversion.

^^Yes. I am thinking of an AC optocoupler like pc814. Just use a 500/2 = 250E resistor to connect bkue and brown power to the LED, and the optocoupler can work bidirectionally without worrying about absolute ground and -v voltage difference.

Indeed, unless the motor uses PWM, you will have the following combinations




and many more….

0 is grounded or "-" or "battery negative", this may be the place to cause confusion-except for the positive battery, it is not a true negative.

The "positive" of Figure 1 is again similar to an RC car for a battery-powered "floating" circuit, and it is meaningless unless compared with the negative of a battery.

I work at HV and have read some of your articles, uh... Yes

Although you said that there is no common pin on the receiver, is it probably the power ground wire or the battery negative? You can connect it to the Arduino ground, and then you only need to have a diode and a series + pull-down resistor on each side of the motor driver to convert to a logic level (positive = high, negative = low).

Or, you can connect two optocouplers (with current limiting resistors, of course) on each motor output in a similar way to the above relays, and simply connect the outputs through pull-up or pull-down resistors as needed To arduino. Much smaller and lower power than relays

If you just want to read the on/off signal instead of the analog signal, my first thought is to also use an optical isolator. Low current consumption and maintain complete isolation between the two circuit boards.

If Rx's H-bridge output is PWM (most likely), then this is the case. However, if you want to enter the analog input, or if there is a capture/compare peripheral on the microcontroller, you need to convert it back through a suitable size resistor and capacitor. You can sample the rising/falling edge and measure between them. Tick ​​between to get the value. Using capture/comparison is probably the least number of parts, power consumption and CPU load.

By testing the last light with an oscilloscope, it looks as if grounding the negative of the battery on the circuit board (it turns out that it is marked with such a mark on the circuit board) actually causes the output to be positive relative to that ground. So, as many of you have suggested, it looks like connecting it to the ground of the Arduino, and adding some current limiting resistors and pull-down resistors is enough.

By the way, this receiver does not have PWM. The transmitter's paddle looks like it needs to be speed controlled, but it's actually an internal on/off switch.

You can use an operational amplifier to change the voltage level. But in fact, the problem here is not that you want negative numbers to be positive, but that there is no commonality between the outputs. (Then and you really want three-state inputs; HIGH, LOW, NULL)

I will give up the reading method of 1 pin per channel. I think you are full of complaints towards the end, so this is the third relay. I strongly recommend using MIT OpenCourse on op amps:

What you might want is to bias the op amp and reduce the signal gain. The idea is that the op amp is biased to a neutral but halfway voltage, such as 2.5v. When the input is negative, the output is 0v; when the input is positive, the output is 5v. Indeed, you may end up turning around because the circuit requires less passive to output 5v at high input and 0v at low input.

If you do try to bias the signal, then I suggest you create a voltage divider (with a very small resistance value) between the two wires, which is sufficient for your situation.

As N1JPL said, it sounds like the signal you are trying to convert already comes from the H bridge. Of course, they may not be enough to drive drilling motors. Depending on the structure of the receiver, you may be able to find the PWM signals between the actual radio receiver and the H-bridge on the receiver unit, and then plug them directly into the Arduino. Even go directly to the larger H bridge. Is there a close-up photo of the receiver circuit?

I opened it for the first time and uploaded a high resolution photo here

. There is also an editor at the bottom of the article with the link. It is too large to be embedded.

I admit that I don't know anything about it. Through searching, it appears that the chip is the actual receiver. It seems that Y2 may be a FET, and D2 may be a diode or an NPN transistor (BCW32), both from

, But HY1D has no content.

You can still find the location of its gate (if it is a FET) or base (if it is a bipolar transistor), without even knowing its exact part. This is the only pin that is not connected to the motor or power/ground.

HY1D looks like an NPN transistor MMBT8050 rated at 1.5A.

Y2 looks like a PNP transistor SS8550 with a rated current of 1.5A.

They are located on the L/RH bridge, I had expected the F/R bridge to have higher specifications, so it is strange to see more Y2.

I will give up trying to get good mcu power from the motor to PWM signal, which is bound to be unstable and error-prone. Just use a 7805 or similar linear regulator connected to the battery, or a buck/boost converter that directly removes the 5V power from the battery. You don’t need to turn positive numbers into negative numbers:)

If it is on the kanban, all components are labeled, DP+, Y2 and L7 components are transistors with a "Q" label. This number is just an increasing counter, and each component has a unique number in each component type. R stands for resistor, D stands for diode, Q stands for transistor, C stands for capacitor, L stands for inductor, Y or X stands for crystal/oscillator, etc.

You can see that each output has 4 transistors or mosfets, so there is a complete H bridge. These bridges are controlled by the smaller transistor L7, because the R288-2 chip cannot output a signal strong enough to overcome the gate capacitance (for MOSFET) or current (for bipolar transistors) of the MOSFET. If you want to copy it yourself (with higher current capability of course), please make sure you have studied how to properly control the MOSFET from the arduino. Especially for PWM signals above 1kHz, capacitance will become critical.

Don't be fooled by the small size components, if the design is correct, they can control large current without heating!

My guess is that the gate or base of these transistors are directly connected to the Bright R288-2 chip. You can use the multimeter continuity check mode to see which pin. If not, there may be a resistance between them. The resistors R12...R15 seem to be connected to the R288-2 chip, and the other end of the resistor is connected to the L7 transistor. These are the signals you are looking for.

If you have an oscilloscope, you can easily identify the signal and voltage level and connect the ground terminal of the oscilloscope to the battery ground terminal (labeled GND). Put the probe on the smaller transistor pin, check the reading, and then probe the pin of IC1 (R288-2) to see if you can find the same signal.

The voltage of the signal cannot be higher than the battery, so please pay attention to whether it needs to be level converted for arduino. Connect the GND of the arduino to the GND of the battery, the solder lead of the L7 transistor, use a voltage divider to reduce the voltage if necessary, and use an online calculator to obtain a good value. If it is between 0V-0.6V (logic low level) and 3-5.5V (logic high level), the arduino should be able to handle them.

That being said, you are making it difficult for yourself to use toy electronics. There are already ready-made modules for RC, which you can plug in and connect to arduino, motor and other wires. Although I am not an RC expert, I cannot suggest any modules, but I am sure that there are many people here to join.

Thank you for your help, helping you read the board, guys, and the detailed tracking tips, i.e. imqqmi. Interestingly, I have been trying to find the part number, except for the capacitor, I don't even have the text on the board. I did read that book in some way.

Re-using toy remote control toys instead of off-the-shelf toy remote control toys, I did not realize that the prices were comparable at the time. But for motors, etc., there are still cost issues, at least when they are all added up. The way I went was that one drilling rig cost $10 and the other was $0. My double H-bridge cost me the price of a MOSFET because I have everything else. I also learned a lot of things, which is much more than I buy ready-made things. This is my first time using MOSFETs, and it is worth it. Coupled with the experience of designing the board, even if this is excessive, debug the whole thing.

I understand your reasoning, and this is my method of learning:) I commend your thinking and learning methods out of the box.

I also set myself a challenge to use only what I own and try to keep costs low, but sometimes, if you want to accomplish something, it's better to invest in some ready-made modules that are known to be available. You can take them apart at any time and understand how they work.

I have been trying to figure out how to use a graphics display salvaged from a Lexmark color laser printer (128×64 pixel dot matrix). I learned about jtag to try to dump a custom lexmark controller by building a custom buspirate. I have to learn to use Linux to use openocd. Finally, it still cannot connect. It also has an i2c port, and I made an i2c address scanner to find out which address it uses. Unfortunately I can't figure out the protocol, but I can reset the display using i2c.

The last thing to try is to make the logic analyzer capture the reset signal sent through the 14 data signals, and try to find out the protocol and registers that must be written to the LCD using my own controller. Fingers crossed, I hope the LCD module will survive my poking :)

The receiver SMD pin is arranged in the following brief description

If you want to skip the operation of converting negative numbers to positive numbers.

However, if you want to divide the positive and negative parts of the signal into two positive pins, there seems to be a trivial way, but it looks incredible, and tomorrow I will have to do some experiments to verify that it actually works.

I will return:)

You can use two optocouplers and 3 resistors to achieve this.

Anti-parallel LEDs. This will be sent to your H-bridge through a suitable current limiting resistor.

Then, connect the transistor in the form of a totem pole, and connect the other two 1K resistors in parallel with each collector and emitter pair. Connect the top of the totem pole to the power supply of the microcomputer and the other end to the ground of the microcomputer.

The resistor divider sets the output voltage to the midpoint of the micro power supply.

Then, the PWM signal from the H-bridge will drive one or the other transistor according to the direction.

Therefore, the full forward direction will be your micro's VCC, and the full reverse direction will be GND.

Oh, thank God, I found this comment. I'm going crazy. The 2 optocouplers are what I thought about after reading the question about 2 seconds.

However, after seeing all the crazy designs and complex solutions, I began to wonder if I was crazy about it, and I am glad that others mentioned it.

Or, buy a suitable multi-channel TX/RX pair from eBay for just $40. very easy. You will also get better information.

Why has no one suggested these obvious choices?

I would have used 4 optocouplers and 2 current limiting resistors.

For each motor (forward/reverse (F/R) and left/right (L/R)), connect two optocoupler LEDs in anti-parallel as described earlier. Connect the LED through a current limiting resistor instead of one of the motors.

At the optoelectronic output, you have a pair of outputs-refer them to the MCU ground and connect both outputs to the MCU. For each motor, only one of these outputs is valid, depending on the driving direction of the motor. From this, you can use the code to restore the motor direction and PWM.

The software polling of 4 optocoupler outputs will be very intense. You will find a way to capture pulse edge timing using MCU peripherals (input capture timing) would be great. This may require mixing the photoelectric output in a way that allows all four signals to send their pulses to a single pin for edge time capture.

Alternative method: You can probe the receiver board to try to find the output of the receiver and decode 1 receiver output instead of 4 motor outputs.

Alternatively, you can go back to the beginning of the R/C chain-back to the transmitter. Before transmitting the joystick signal, use the MCU to remix the joystick signal to obtain the desired operation from the unmodified receiver. The problem is that the F/R output of the receiver may be more powerful than the L/R output. L/R may not be able to drive a motor of the same size as F/R. You can replace both existing H bridges with your own (the same as you planned). You must reverse engineer the receiver motor output.

After some time, from the perspective of development work, the use of conventional R/C controls began to appear attractive. You can exchange $$$ for development time/energy. Especially if you plan to add more features in the future. But what's the fun?

Polling for four inputs is not "stressful" at all. Set up a timer, and then view the status of each pin when the timer is off. There is no easy way.

The way I did this in another project was to use two resistors and one of the two outputs to form a 2:1 voltage divider towards the positive rail of the receiver. I assume that the driver is isolated from the receiver power supply (this will increase the cost, but there is no practical reason), so assuming that the RC receiver is 5v, *should* be solved with only two resistors. If it is higher, you need to connect the third resistor to ground.

Therefore, one resistance goes from the wire (brown or blue) to the other equal resistance to the positive power supply of the RC receiver, and the third resistance is grounded from the connection point between the two.

Maybe an opto-isolator is set up so that the internal LEDs are back-to-back, so when the polarity changes, it will change the photoelectricity that is turned on. Then, the transistor side is connected to the arduino pin. It has the same basic idea as the relay, but it saves electricity.

The combination of modular synthesizer and Arduino knows the same challenges.

Check this design:

In my opinion, optical isolators can solve the problem. Use four of them with two LEDs on each RC receiver connected from the anode to the cathode of each RC receiver with a common series resistance. Neither one, the other nor both light up at any given time. The forward conduction of one will protect the other from excessive reverse bias. The secondary side (phototransistor) can be connected as a simple open collector output. The arduino pins can be configured with internal pull-up resistors. It's done.

Can't you use a bridge rectifier to change a negative voltage to a positive voltage?

it will. (Minus the diode drop) However, it will change the positive voltage to (still) positive voltage, so you can no longer distinguish "forward" or "reverse" signals...just "the motor is running".

This is a bit rough, but I listened to the high and low of the analog signal, serialized it through a pipe to find out what happened [no scope], and then coded around it

If you want to use the H-bridge output, relative to the negative of the RXVR power supply, the signal on each pin will still be positive, one direction is +ve, the other direction is 0V, and the other direction is the opposite. This will use 2 pins on the Arduino to read + – forward – + backward ++ stop – stop.

A resistor divider may be needed to reduce the voltage to the input level required by the Arduino, but it is much simpler than a relay/optocoupler/transistor

Ebay has been providing ESCs with reverse ESCs for brush motors all day long. If you can use arduino to make beep and bloop sounds, you can easily control several RC ESCs. About 1000 to 2000 uS PWM, of which 1500uS is the dead point. Not only can you own drives, you can also have proportional drives. Ramp up, ramp down, less moving robot...

This is why I hate ardunio people, they always want super complicated circuits, robots and things, but they don't want to do any actual work. "Just give me the library!" They said...Uh.

I digress

I think this is back to the root of hackers! Use with OTS wall-mounted world remote control car. Reminds me of when I was ten years old...maybe more interesting than OTS parts.

Hey man, I am completely new to RC, but I stumbled upon this and started thinking about it. Sorry if I am completely wrong.

Is there no PWR/GND associated with the RC receiver? Did you tie the GND to the Arduino GND instead of one pole of the drive wire? Then, you will need to use two input pins on the Arduino, and connect a diode in series to the input pin on each drive line. If the drive line generates +5V / -5V in one way and -5V / +5V in the other way, then 3 diodes are connected in series to make the voltage drop to close to 3V (the cathode is facing the Arduino). The diode will block the negative voltage from the Arduino.

If this is indeed a floating voltage, which seems strange to me, then you can connect a larger resistor between each drive wire and Arduino GND. This will set the reference voltage of each drive line to 0V, and I will use the same diode method as above.

Now, I will be expecting a complete error and hope to learn something! :)

If the voltage is actually a negative voltage, not just swapping ground and power, can you not connect a voltage source greater than the maximum negative voltage in series to make the voltage positive, and then use several resistors to divide the voltage to the level where you need Arduino?

On similar chips, I directly used the output of the chip pins and ignored the H bridge on the board. Found the data sheet of the chip, but you may only need to check the trace of the test circuit board through the H-bridge.

(Written in "recipe style", I don't mean to sound "clumsy")

Connect the signal from the remote control car control chip to its H bridge. (For the H bridge, they are Q5, 6, 7, 8 and 11, 12, 13, 14.) Feed these signals to your arduino, if they are higher than 5V, use a series resistor (if you don’t want to abuse the input For protection diodes, use Zener resistors), such as 10k to 100k, or a voltage divider. If they are PWM wired, connect them to the analog input and use an RC filter (try to ground the 10k + 100n series, please check with an oscilloscope and increase any value until you get a smooth DC voltage).

Actually, connect the GND of the receiver to the arduino GND.

To me, it sounds easier than using some kind of relay.

Why does it appear on hackaday? In my opinion, this is more like a question you want to post on an electronic forum.

Not a hacker!

I thought I would never be one of those "not a hacker" guy, but sadly, I must agree with you...

That big article is just a common question belonging to the electronic forum. There is nothing new or interesting to learn.

Make the remote control car "ground" = 3V. Then 8v represents the 5v track. And connect a high resistance 100k to 1m ohm between the output and ardueno.

The AVR has a solid diode clamp on the pin to withstand high voltage. Oops, there are even application notes about feeding 120v AC with the same settings.


3.3v = off

5v = forward

0v = reverse

If you really want to use an existing receiver, use two optocouplers per output (4 in total). If you have a forward bias and a backward bias, they will provide you with a discrete digital output, which you can send to the arduino, or you can even filter it to provide an analog level.

That said, I think a better option is to get the ready-made RC receiver standard (no h-bridge) and use its servo/esc channel PWM output. Then arduino can measure the pulse length-above a certain threshold (such as 1.5ms) is forward, below a certain threshold is reverse. Standard receivers and transmitters are cheap, less than $30-for example

Generally, you can modify the exerciser's addition/removal of springs or pawls.

You cannot just connect the -5V wire to the input pin. Enable the internal pull-up resistor, and then execute a digital read to detect LOW?

I think it's easy without making all the comments first.

Because: you have no negative voltage. At least if you lead them to the correct potential, the negative terminal of the battery. Then, you can view the voltage of each half bridge of the two full bridges independently.

Therefore, as a general formula:

I connected a voltage divider to each half-bridge output, which gave me a convenient midpoint voltage.

From here on, it depends on the battery voltage supplying the motor output. For each half bridge, you must distinguish 3 states: low, off (medium voltage) and high. You can use a comparator or voltage divider to connect the input

For very low voltages, you can also use transistors (with base resistors) or small MOSFETs:

Connect E (or S) to one output, and connect the base resistor (or G) to the corresponding output of the other half bridge. Connect a pull-up resistor from C (or D) to the microcontroller power supply (5V/3V3). And connect the second one in another way on the same motor channel, so E is at the junction of the base resistance of the first transistor, and the base resistance of the second is at the junction of E of the first transistor .

The second transistor has a similar pull-up. Now you have two direction signals.

Do the same for other motor channels.

It is essentially positive = A *! B, backward=! A * B instead of = Az * Bz

Where z = high impedance.

For speed control (if supported by the RC board), I will use an op amp to bias it half forward into an analog pin and the other part towards the servo controller.

The deviation on the drive should be programmed to a value less than zero to produce a negative integer, and vice versa.

When the two wheels are programmed to deviate halfway between the zero offset and negative/positive, the steering system should zero any motor. In this way, one side may be completely tilted, but the other side may be required to slow down or move backward, depending on how hard you push the rod to both sides.

"Hope it makes sense for Dad to smoke"

I mean (referring to) the H bridge under "+1"


Look: you are not trying to change a negative voltage to a positive voltage. You are trying to ground the correct wire. You have two H-bridges driving four wires. This means that zero, one or two wires can be connected to the positive pole of the receiver, and zero, one or two wires can be connected to the negative pole. Assuming that the receiver uses a negative ground topology, the negative rail is the "ground" of the receiver.

Connecting all four wires via diodes (connecting the cathode to each drive wire) will create a "virtual negative rail" that is one diode voltage drop higher than the most negative of the four driven wires, you can Connect it to the Arduino ground. These diodes essentially ground the correct wire.

Then, relative to this virtual negative rail, all four wires will be zero or positive. Then connect the drive line (if the voltage output by the receiver is too high, through a voltage divider) to the four digital pins of Arduino. For each motor, when the motor is not driven, you will get two logic low levels, and when the motor is driven, you will get a logic high level, and only one logic high level indicates the direction.

Oh: To deal with the situation where neither of them are driven, which will leave your "virtual negative rail" floating, just connect the weak pull-down resistors (~1K to 10k) on the four driving wires to the Arduino ground.

Steven: After looking back, and carefully reading some of the other suggestions and your answers, I realized that this is much simpler than this-no diodes are needed. The article gave me the impression that you do not have access to the circuit board, but only the motor. Just connect the negative terminal of the battery to the Arduino ground. The H bridge does not generate negative voltage. Like I said above, it just connects one of the outputs to ground and the other output to the + rail. Therefore, measuring each motor wire relative to the negative (ground) of the battery, you should only see the positive voltage.

However, there is another thing: You said that you think the receiver is good because it came out of a work toy. However, once you said that you connected the blue wires of two motors together. This is a very bad thing, because as soon as the receiver tries to turn the motor in the opposite direction, the receiver connects one of the wires (through the MOSFET) to ground and the other wire to the positive pole. So by now, your receiver may have toasted.

Through the test I conducted with an oscilloscope last night, it seemed that grounding the negative of the battery on the circuit board (it turns out that it was marked with such a mark on the circuit board) actually caused the output to be positive relative to that ground. So, it looks like it is enough to connect it to the ground of the Arduino and add some current limiting resistors and pull-down resistors. Implementation will take longer.

But fortunately, the receiver is not toast. It is actually part of a fully functional BB-8 robot, using my oversized conversion board (because of all these notes, it will be replaced by a simpler soon).

My first idea was also an optocoupler, but you only need two. There is no need to optically couple the forward signal. You can follow the forward path you first tried to route).

For the negative path, the optocoupler LED input can switch the transistor output to connect directly to your input.

Think further: When the receiver switches the motor in one direction, what voltage will you get between the blue wire and the negative pole of the RC receiver battery? I guess that in one direction, the blue wire will be positive compared to the negative of the receiver battery, and in the other direction, the brown wire will be positive.

If so, please connect the arduino GND to the receiver's battery negative terminal and connect the 2 inputs (via appropriate diodes/resistors) to the corresponding arduino inputs...

I would be happy to follow up on this to understand the solution you implemented.

I am surprised that no one mentioned MAX232/ST3232/etc. They are natural positive/negative/logic level converters. Or did I misunderstand this question?

As an RC guy, I want to say that your problem starts with the RC gear of the toy car, instead of just using some standard, documented RC gears. Conventional RC gears have many flavors, but the standard output is one of the following:

1) Multiple PWM channels (old style)

2) Combined PPM signal (intermediate ground)

3) Series (New Era)

Of course, there are various other possibilities.

Assuming you want to use relatively cheap products, you can get the FlySky Gt3b tx/rx kit for more than $30. It provides multiple PWM outputs. I learned that $30 is much higher than the price of a free toy truck, but sometimes the time saved is worth the time. Of course, if you like to hang out, what do you say?

When your grounding method is not ideal, opto-isolators can usually solve the problem, and usually provide the necessary electrical isolation in this application. You can do many tricks on the motor output. For example, you can use two opto-isolators and one of the LEDs is reversed to provide three possible signals-one of the opto-electronic outputs is on (high or low, depending on how you connect the pull-up or pull-down) to indicate that it is reversed . The other side means forward; while both are off, it means the motor is completely shut down.

If you don't have any optical isolators hanging around and insist on operating in a wired manner, then you are thinking about the problem in a useless way. The RC circuit may be a single-ended design. In other words, there is only one positive power supply, and the ground voltage is the lowest. If you can touch the ground, then these two wires will become simple "digital" outputs, always 0 or positive power.

Or, if grounding is not possible, there should be two diodes on each motor output wire (one from the ground wire to the motor wire-the negative side points to the motor wire, the other from the motor wire to the appropriate voltage digital I diode with pull-down resistor /O to complete the work.

But, in fact, if you understand all of these, you can also pull the original I/O line from the wireless controller IC. The h bridge has two outputs, and each half of the bridge has an I/O output. This should give you more or less all possible states (forward, reverse and motor off). There may be some level transitions, nothing more.

Will such a simple rectifier not work? One side is the "polarity" blue and brown, the other side is the DC output of the same polarity...

This is the circuit that should perform what you want.

The output of the RC driver is fed to the input LED of the optocoupler. Two optocouplers are connected in parallel with the input diode, but with opposite polarities. If there is any motor drive voltage, one or the other LED will light up, as will the associated output transistor.

If there is no motor power supply, the Arduino will see that both of the pair of inputs are high, and if there is a motor signal, one of them is low. Which one is low will depend on the direction of the motor.

Since optocouplers have no electrical connection between input and output, there is no need for a common ground reference between them.

Thank you! I don't know which route I will take, and may even try multiple routes, but it will definitely make it easier.

I'm not sure if I understood what you mean correctly, but won't this simple circuit?

This is a simulation of the circuit:

No, this simple circuit is called a bridge rectifier. Used to convert alternating current to direct current. Yes, you can use it as a direct current, but unless the input and output grounds are isolated from each other, it will not work properly. Try to simulate, you will quickly find that you have connected the input power to ground through a diode.

Please be kind and respectful to help make the comment section great. (


The site uses Akismet to reduce spam.


By using our website and services, you expressly agree to our placement of performance, functionality and advertising cookies.