Rocket Reaction Control Thruster and Leg System Diagram and Code Help

Hi,

I am making a model RCS system for a university project. The TLDR is that an arduino nano controls 4 solenoid valves via a 12v relay, and the valves release pressurized air from 4 nozzles placed at the top of the rocket, 2 along the x axis and 2 along the y axis, thus altering/correcting its orientation. The switching of the valves is controlled from the arduino using an IMU (gyro). Additionally, there is an arm switch, that starts the sequence, and there is a buzzer , LED, and 4 servos that deploy some legs when the arm switch is switched to ON.

Here is the very messy and crude electrical diagram. The connections will be made on a breadboard, except for the relay and valves, that draw a lot of power from a different power bus (you will noitce that I also used some placeholder modules). I connected the servos on PWM pins and matched the IMU pins to the standard use analog pins used on most codes for that module. Can you spot any mistakes?

Unfortunately my arduino knowledge is lackluster, so I have come here for aid.

Here are my questions:

Can I just connect the signal wires from the arduino digital pins and a GND And 5v wire from the arduino to the valve relay (12V 2A power source powers the /valves) and expect it to work normally? Or is there a problem with the voltage dfference between the arduino and the relay/valves? If so, how is it adressed?

Can I use power from USB to power the rest of the electronics through the arduino (5v)?

Can I put the led circuit within the buzzer circuit, so they both operate at the same time?

And most importantly: The IMU I will be using is the mp6050 on the gy-521 module. I want to use the onboard processor to improve the quality of the inputs.

Can someone help me with the code? I need a library and code segment that gives the gyro inputs, as well as some variables for fine tuning and error correcting. These values will be used to switch on the valves on when the lean of the rocket on any of the 2 axis is more than 1 deg. , and close them when the value get below 1 again. Also I need help with making a code that starts deploying the legs , activates the buzzer and led for a brief time and starts the valve when I activate the arm switch, and retracts the legs and activates the led and buzzer briefly and stops the valve part of the program, until it gets switched on again.

I know that this is much to ask, but I thought that I would rather gather it in one big post than posting lots of smaller ones.

Thanks in advance,

PanagosDm

The diagram did not get posted. Also you need to write some code. Nobody here is going to do that work for free.

What relay? What do you mean by connect?

Probably.

Yeah.

What onboard processor? The inputs from that device are already fairly accurate.

You're going to have to do this yourself. Figure out how to interact with the "legs" and then manipulate them as needed. There's also no shame in modifying example code. Preferably, make sure you understand what it does so you can debug later.

Thank you for your reply.

By relay I mean relay modules with optocouplers, the typical relay "shields" or boards if you will. I was wondering if I can just connect fro example digital 9, 10 and 11 on to the relay inputs 1, 2 and 3 and expect it to work, or do i need to connect the grounds of the two devices, or do i need to do something else?

The mpu6050 has a dmp digital motion processor that merges the gyro and accel. data to imporve accuracy and minimize errors, thats what i am talking about.

Can you recommend a good starting point of a similar example of the code we are talking about so that i can start reverse engineering?
Or any good sources? So far i havent found anything similar to what i need.

Dot misunderstand me, I did not ask for free work. Non the less I hope you understand that I am a arduino novice and I havent been able to find code similar enough to what I need in order to learn from it. Hence, I am asking for pointers. About the diagram it should be fixed now: ARCS-Electrical-Diagram — ImgBB

Have you studied the example code that ships with the IDE, and tutorials for them, on this site?

I don't believe you can't find code and connection diagrams to operate relays. I'm sure I could find one using Google in less than half a minute.

Sorry, but if you really want to progress efficiently with this project, you have to do some basic online research before asking here.

Images should be embedded in a post, not linked to. Obviously, you have no experience with electronics. Relays do not provide power, they only switch. Your solenoids are connected to relays as if the relays will provide power to them. That will never happen. I didn't look any further for more mistakes. Please do a lot more research and completely redesign your project.

Thank you for your input. However it is very elitist in nature, as is the assumption that I have no experience with electronics. The relays in the diagram are not magic-driven. They are connected to a power source,albeit in a wrong way, thats why I am here I guess.
About the image embeding, I couldn't find a way to attach it directly to the post body.

I took another attempt at the relay/valve wiring, and I found out how to embed images...

That schematic is useless. A maze of wires going in all directions, please clean it up by adding power and ground "busses" instead of weaving them all around like a spider web.

1 Like

How? I know it is crude, I said so in the post.

Edited. Add busses and find the most direct route for all signals.

That's what I had in mind but for the moment I haven't found the way. I have less than 2 hours of experience with this software. Unitl I tidy it up, is the wiring correct now?

What is the relay board? I can't read any of the pin labels on it.

Just use paper and pencil.

1 Like

Ignore the fact that there are 2 2-relay boards, I mean that this is a singe 4-relay board.

Try and make one relay do its thing with blink without delay. No need to have anything controlled by the relay - just watch the indicator led and listen for the click. Don't try to do it all in one go.

Of course for starters thats what you do. But is the above way the correct way to wire it?

Maybe. It looks plausible, but it appears that you haven't shown the relay board that you actually have, so it's hard to be certain.

I have made a mistake while learning about relays. I now understand that the relay I should use is a 5v 4-Way relay. Given the connection of the relay to the arduino through GND, 5v, and 4 digital pins, and proper power to the other side of the relay and the arduino, it will work. For some reason and for some time while diving into this project, as @aarg said previously, I thought that I needed to tie the relay operating voltage to the operating voltage of the valves, which I now know is false. Fortunately I am studying mechanical engineering and not electrical engineering, so this mistake is somewhat not that shameful.
I will re work the diagram and come back with a better post about the code.
Thanks all!

Try to collect documents and/or links for all the hardware you plan to use, so you can post that also.

1 Like