-
• #2
Can you post your code?
-
• #3
Hi,
As far as I can see you have two wires on there at the moment? GND and signal?
I think you also want to attach
VCC
on the Pico toVCC
on the relay. I think you're getting enough power from the Pico's data pin to light the LED, but not enough to move the relay (there should be an audible 'click').You might also want to add the line
pinMode(RELAY_PIN, 'opendrain')
near the start of your code as well (I'll update that tutorial) as on some relay modules the relay doesn't properly turn off without it. -
• #4
You should move that yellow jumper on the relay module over too
The default position should be between
JD-VCC
andVCC
, but yours is betweenGND
andVCC
, which will short the power supply out :) -
• #5
Thanks for the info, will give it a go at my next opportunity (definitely no click so you are no doubt right on the power!)
-
• #6
Woohoo that worked!
How... how would I get the motor to turn the other way? My guess is use both the relays and some diodes? Or is there is simpler way?
(BTW thanks for the help as always Gordon!)
-
• #7
Actually i've found this online using an arduino, looks good, https://drive.google.com/file/d/1fFhEGzO6kGI7plBqrEAgKL9d_WUagGxj/view, I'll try this.
1 Attachment
-
• #8
Great - and yes, the image above is spot on!
-
• #9
So got it all spinning in each direction. Rigged up a coffee cup lid and connected it to the motor.
Didn't use my brain and the motor wasn't able to lift the chicken door (<500g) but ignored it, and we'll the wires started smoking, from memory impedance?
Anyway I've now ordered a higher torque motor which I can just swap in (it can lift up to 2.5kg apparently) https://www.amazon.co.uk/WINOMO-3V-6V-Short-Shaft-Torque/dp/B010SP427I/ref=redir_mobile_desktop?_encoding=UTF8&psc=1&ref_=ya_aw_od_pi
So will give that a go on Friday. The next step is to get some sort of small solar panel and charge unit, seem them for around £6 (I may need to bug you again Gordon!). Just to keep things topped up.
Short term I think it'll just be an LDR and sitting outside with my laptop takin g measurements for door opening Vs closing times. Eventually I'd like to link to WiFi, have a minimum opening time of 7am, and then something ~45 minutes after sunset. LDR is cheaper and doesn't involve me doing the WiFi/cat5 to our garden (longer term plan regardless). Oh and to report that the door is open and closed (WiFi could also periodically sync the time).
Once the motor is working on the door it'll just be two reed switches to ensure door opens and closes at the right point rather than relying on timing which could go wrong, or something could slip (I think commercial systems just rely on time and calibration - maybe good enough, bit reed switches aren't expensive!).
I'll write up the chicken door at some point. Theres a couple of Arduino examples. But it would be good to get an espruino example shared because it's such a great project and I've done it with very little experience and knowledge (except my JS).
Thanks!
-
• #10
Sounds great! Bit scary about the smoking wires though!
Still, the relay module is really good at isolating everything so as long as the smoke is on the screw terminal side you don't have much to worry about with the Espruino board :)
I don't know how you're moving the door, but if you only need rotation of up to 180 degrees then you could look at using a RC servo motor. They have the position encoder and drive electronics in them so they're nice and easy, and they come in a variety of sizes/strengths.
If you need linear movement then I've also seen people stick a threaded bar on the end of a motor, and then attach the thing that moves to a nut on the bar. You'd have to be careful there though because if a chicken got caught in it, it might not stop!
If you're after power for stuff outside, you could look at using a 12v battery (either an old car battery or a burglar alarm/UPS one) and a solar panel - it's pretty easy to get a weatherproof solar panel designed for keeping car batteries topped up. That's what I do for an Espruino plant waterer I have set up anyway :) It's also pretty easy to get 12v->5v converters from eBay that are meant for cars/caravans, so you could run everything off one of those if you need the lower voltage for the motor.
-
• #11
Yeah it was all relay side, switch out a couple of wires (maybe use something a bit thicker too), and use the higher torque motor.
I did originally try to use a servo and a stepper from geek kit from kickstarter but they were non-(kick)starters.
I've had a look inside a couple of commerical units (mainly because you can see stuff on their install videos and it looks like a geared DC motor (e.g. https://youtu.be/Kw6RZGMiz7I?t=2m22s
)As for charging, the commerical units run off 4 AA for a couple of years happily, so the large 4.7v LiPo (4.7v 2700mAh HJ7534100) should go for some time without charging, but that's boring, I was looking at https://www.ebay.co.uk/itm/NEW-Mini-Solar-Lipo-Charger-Board-CN3065-Lithium-Battery-Charger-Board-Module/173335088589?_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D20160908105057%26meid%3D42ddb3fc36d742b49a20773034fd7809%26pid%3D100675%26rk%3D2%26rkt%3D15%26sd%3D163059043652%26itm%3D173335088589&_trksid=p2481888.c100675.m4236&_trkparms=pageci%3Ab37bf9ca-6faa-11e8-8bde-74dbd1800b6a%7Cparentrq%3Afd5a852a1630aada0a15920bfffaf3e8%7Ciid%3A1 and then a small solar panel just to trickle charge it when the sun is around. Its going to be two motor winds a day, and two wifi connections to send a message and then deep sleep so I don't think it'll use much.
Anyway, whilst I wait for the motor I've got some nesting boxes to build. Thanks for all the help
-
• #12
Ahh - using a geared motor and gravity makes a lot of sense. If you still had trouble with the new motor you could add a counter-weight I guess.
I actually had a lot of success with a solar powered USB power bank. Sometimes you might not want to use the USB output directly (Espruino can draw so little power that some of them think nothing is connected and turn off), but it's usually trivial to crack them open and connect straight to the battery - and you've then got a really nice, convenient unit with loads of power.
Using a system very similar to http://www.espruino.com/Heater+Controller
I can see the relay is being switched on and off because I se the IN1 flashing in time with LED on my pico.
However I get nothing from the motor. If I connect the motor across the battery terminals is goes like crazy.
If I move the yellow cable from pin 3 (? leftmost of K1) to pin 1 the motor goes like crazy but there's no switching it off.
I'm clearly going wrong somewhere very simple, little help? Thanks, Lloyd.
2 Attachments