I’m an engineering student working on a lab project, we assembled a robot that has to follow a course, attach to a trailer, then bring it back. the robot is controlled by an arduino and a shield
that came with the robot kit. The trailer hitch is plastic with a hole and sandwiched by washers so my team decided to use an electromagnet to attach the trailer and tow it. The robot can be remote controlled once it gets to the trailer by itself. We tried using unused pins on the shield to power and control the electromagnet but the pins don’t turn off when they’re supposed to so the magnet never turns off. We weren’t able to find the cause of problem so we decided to use a separate arduino and power source for the electromagnet, and I want to use my nano RP2040 because it can be remotely controlled. I’m thinking of using it to trigger the base pin on a mps2222a transistor.
It works if it’s connected to a computer but not if it’s just connected to a power source, because the tutorial I used makes me open the serial monitor to create the access point. Since the computer can’t be plugged into the board when the robot is going through the coarse I need it to work without a computer.
My questions are:
1 can I use the Wi-Fi feature of the nano RP2040 without the serial monitor? If so is there a tutorial that can help?
2 is using the mps2222a transistor a good way to control power to the electromagnet as shown in the second picture?
Any help getting the RP3040 working independently would be appreciated. And any other suggestions or advice would be helpful because I don’t have much experience with this.
Welcome and thank you for a well presented question.
With regards to your hand drawn schematic showing the drive to the electromagnet please read these tutorials before proceeding any further:
You need to understand the principles of both. Also, as you are using a bipolar transistor please look up how to connect one for common emitter use. A MOSFET would be a better choice however. I note that you have not stated how much current your electromagnet takes, this is essential information before choosing a transistor to drive it. Please find out and tell us.
I have no advice to give for your other questions.
Yes. Any tutorial you can find will/should work with or without serial monitor. The problem you have us more likely to be related to the power source(s) you are using. USB provides a well regulated 5V power source up to 0.5A current, which is enough to allow wi-fi to run correctly. When not connected to USB, how is your project powered? (I am worried that your answer will include a 9V battery!)
Maybe not, and certainly not as shown in your schematic. As @PerryBebbington says, you must have a flyback diode, or the transistor and maybe the Arduino will be damaged, and the transistor will not switch on without a common ground. Also you must have a current limiting resistor on the base of a BJT, otherwise the Arduino pin can be damaged. Depending on the current drawn by the electromagnet, you may need a higher power transistor, preferably a MOSFET such as IRL44Z or similar (one with a logic-level gate, suitable for a 3.3V logic input). If you don't know the current draw of your electromagnet, use a multimeter to measure it by connecting it directly to the battery, or measure the resistance of the electromagnet with the multimeter and calculate the current using Ohms law.