So I recently purchased a Grove Electromagnet + GrovePi+, everything works perfectly. However for the effect, I want to show in my experiment, I need more power out of the Grove Electromagnet. I'm not fluent in Python so do not know how to call this module/function. It is labeled to have 25N hold but I can't seem to even get a tenth of that, I know it is working because I tested it with a little screw, it seemed to hold it in place, but when I try to attract the screw from about a cm away it the effect isn't present. I know the relationship between distance and power, it is the inverse square law. But it should still attract, that's why I've concluded that the Electromagnet isn't being used to its full potential. Can anyone help? Thanks! I'll still keep looking.
Edit: I realised that from my prior knowledge in Python that if the output is set to something like 'GPIO.HIGH' then perhaps i can get more power to it. I'm going to try it.
import time
import grovepi
# The electromagnet can hold a 1KG weight
# Connect the Grove Electromagnet to digital port D4
# SIG,NC,VCC,GND
electromagnet = 4
grovepi.pinMode(electromagnet,"OUTPUT")
time.sleep(1)
while True:
try:
# Switch on electromagnet
grovepi.digitalWrite(electromagnet,1)
print "on"
time.sleep(2)
# Switch off electromagnet
grovepi.digitalWrite(electromagnet,0)
print "off"
time.sleep(2)
except KeyboardInterrupt:
grovepi.digitalWrite(electromagnet,0)
break
except IOError:
print "Error"
This is the code that is working, how would one edit it so that it is at the highest possible setting. Something like 'high' or 'max'? I'm still looking for the documentation for the 'grovepi' module. I think it only takes 1 or 0 sadly... :(