I am completely new to the world of electronics and automation so am looking for some well informed advice about how to automate a research project I am doing with horses. In the past we have used a mechanically operated device (by the horses) but this makes collecting precise data about how long they take to learn and how many repetitions they do very labour intensive and prone to human error. So am looking to automate this using a Raspberry Pi or similar.
The basic experiment is as follows:
A buzzer/tone sounds telling the horse the trial has started. They then touch a panel with their nose. A second, different buzzer sounds telling them they made the correct choice. After a short break (2-4sec) a fixed portion of horse feed is dispensed from a hopper into a bucket. They eat the feed and after another fixed period of time (5-10 sec), the start buzzer sounds and the next trial begins. At the end of the session, a third tone sounds, indicating the session has finished.
What I am wanting to automate is the following:
The tones, the panel touches (touch sensor), the dispensing of the feed (servo motor) and the fixed durations between the various components of the trial. I also need to record things like the latency between the start tone and the panel touch, the length of the individual trials and the session duration in total. I’ve got an experienced python programmer to help with the coding but they don’t have experience with hardware side of things.
We will need a servo motor capable of managing up to 5kg of the feed and able to be controlled so it dispenses a set amount. The tone/buzzer will need to be quite loud as the experiments take place outside and the touch sensor would need to be suitable to put under something like thin perspex or metal sheeting to protect it from horse slobber. Hoping that all of these functions could be coded into a single Raspberry Pi or similar. The end product will then be built into a robust weather proof panel with the feed dispenser.
So really hoping to get advice on the components we are likely to need to achieve these functions as well as associated cables and anything else. Thanks in advance.
This sounds like a really interesting project, and an excellent use for a microcontroller.
Just to start, could you elaborate on the existing mechanical solution? Is there any chance you could simply retrofit a limit switch or encoder to the existing device to record data?
As for a digital solution, a full-size Pi might be overkill, a Pi Pico would definitely be up to the task.
You can use an SD card to store recorded data:
As for the buzzer, a standard piezo should be quite loud, though if you find it’s too quiet you may have to drive it with a higher voltage.
As for the buttons, I was thinking a capacitive touch sensor would be appropriate, as you could attach it to metal squares that the horses can boop with their nose, but slobber might cause a reading that stays on longer than intended. In that case, maybe manufacturing your own large slobber-proof button that pushes on a roller switch would be appropriate:
The servo motor is a bit of a hard one.
Your choice of servo will depend on what sort of mechanism is attached to the servo. If you can give us more info on the torque and range of movement required, we’ll be better equipped to suggest one.
Let me know if you have any followup questions to this
Unfortunately we can’t retrofit sensors to the mechanical device due it’s design. We had a number of problems with it so have decided to start from scratch.
For the servo motor, we are thinking the of using a piece of PVC pipe into which the feed will be placed. The bottom of the pipe will have a hole cut into it and the “door” will be attached to the servo. The plan is that when the servo moves however many degrees, that will create a hole through which the feed will fall out and then the servo will be returned to the start position to close the opening. The feed will then gravity feed down another pipe to a bucket where the horses will access it. We anticipate being able to put between 2-5kg of feed into the hopper each time.
In terms of the touch sensor, we need something to sit behind protective plastic-probably a 1mm thick piece of perspex or sheet metal. But it still needs to be sensitive enough to detect a soft nose boop or swipe. The horses can get frustrated quite quickly so we need it be be sensitive so they quickly get their reward, otherwise they start chewing and breaking things!
Below is an indicative picture from a different study carried out by another team, showing the general idea re the hopper and feed tray. In this study, horses could choose one of three options and the detection system was IR beams. However the authors have advised us that the IR beams were problematic which is why we want to move to a touch sensor instead. We will have only one option in our study. Thanks again for your help.