Hi Guys, I am new here. Hopefully you guys can help me with something I am trying to build for the first using raspberry pi. I would like to connect two electromagnets using Grove Pi and switch on and off with a set time. The time different might be in 1 - 100 micro seconds. Do you think this is achievable? let me know if any of you tried this and what was the sample code and connection you used. Thanks a lot.
I don’t think anyone has tried that here at all.
One thing is for certain, you won’t be able to drive an electromagnet of any strength directly from the Grove - you are going to need some kind of a driver - like a motor H-Bridge.
As far as the software is concerned, you’re in uncharted territory. We will give you all the help we can once you start coding and have issues, but you are going to have to do the work.
Let us know what you decide to do.
Are you referring to this Grove Electromagnet?
Will you be turning both magnets on at the same time? (not familiar with the GrovePi 5v supply specs - You should research that the GrovePi and your power supply to the GrovePi will support the Raspberry Pi power plus the GrovePi power need plus the electro magnet current)
The linked electromagnet does not include a performance specification, but even 100 uSec sounds to me that you might be expecting too much from a consumer grade electromagnet.
There is a lot to consider when working with electromagnets - this document might give you the vocabulary to ask vendors about their electromagnet performance.
Perhaps this conversation on the performance of electromagnets, you will find useful: