bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

How to control a 360 servo

Fri Sep 10, 2021 4:44 pm

I'm a beginner to python.
I'm trying to control a ls-8101f servo in Python.
I need the code too turn the motor 180° and then stop.

User avatar
joan
Posts: 15783
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to control a 360 servo

Fri Sep 10, 2021 4:49 pm

What have you tried?

Have you got a link to the servo specs?

pcmanbob
Posts: 11937
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How to control a 360 servo

Fri Sep 10, 2021 5:06 pm

Does this servo just turn continuously when you try to drive it, as that is what the data sheet suggests it does, as they quote a speed per rotation.

If it is such a servo then I don't think you will be able to drive it to a specific angle like a normal servo.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Fri Sep 10, 2021 6:26 pm

All the code that I have found on the internet does not work.
I have a stock bare Bones raspberry pi 3B+ with barebones stock installed raspbian OS. some code example would be nice to test to see if the servo even can be stopped. There's an adjustment pod on the front of the servo. If this is not possible what servo do I need to replace it with that rotates 360? I would like to try to adjust the servo before setting it aside. The manufacturers example code is in Arduino.
Attachments
Photo on 5-24-18 at 7.56 PM.jpg
Photo on 5-24-18 at 7.56 PM.jpg (135.24 KiB) Viewed 1118 times
Last edited by bob5731 on Fri Sep 10, 2021 6:49 pm, edited 1 time in total.

User avatar
neilgl
Posts: 3667
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: How to control a 360 servo

Fri Sep 10, 2021 6:43 pm

What is the intended application for the servo, as we have “I need the code to turn the motor 180° and then stop” and also “ what servo do I need to replace it with that rotates 360”
Myself I use cheap SG90 clones and the excellent pigs

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Fri Sep 10, 2021 6:56 pm

I'm working on a pill dispenser. If I had some example code I could go from there. 180 was just an example.

User avatar
joan
Posts: 15783
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: How to control a 360 servo

Fri Sep 10, 2021 7:40 pm

Try the following to identify the type of servo.

See https://pinout.xyz/ for GPIO numbering.

sudo pigpiod

pigs s x 1700 # x is the GPIO number

If it continues to rotate in one direction it is a continuous rotation servo. If it stops after a fraction of a second it is a normal servo.

pigs s x 1300 # to rotate the other way

pigs s x 0 # to stop rotating

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Fri Sep 10, 2021 9:14 pm

What would a stepper motor be better. I rubbed a couple of them from an old cricket cutting machine.

I'm PC technician so this is all new to me. I know I would have to drive the the stepper motor with some type of driver board. I couldn't find the data sheet for it. The servo I have is a continuous servo. I have a couple ideas that I found on thingiverse that might work to dispense the pills. I'm just trying to put together a pill dispenser that does not charge a monthly subscription. I'm currently using the hero kill dispenser but don't want to pay $29 a month.

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Fri Sep 10, 2021 10:19 pm

You probably don't want a "360 servo", which really you should be calling a "continuous rotation servo".

You probably don't want a stepper motor either, although you have correctly spotted that you would need a driver for that.

Based on the scant information you have provided, you probably need a regular servo and some linkages to allow it to open and close the pill dispenser. The typical range of movement of a servo is 180°, which you can think of as a central position (0°), +90°, and -90°. You can use the servo's position directly, or drive a gear train, lever, or linkage, to increase or reduce the range of motion.
Hmm. What can I put here?

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Fri Sep 10, 2021 11:33 pm

That might work but I was thinking about using 10 to 20 different pills let's say I take five pills in the morning two of them being the same can I take five different pills in the evening. Easiest way I can think of is to use a web script for the input side. Have the raspberry pi save the information and dispensing at different times. I may be trying to reinvent the wheel here. When I get some free time I'll post a couple links to some projects that do exactly what I need. The only problem is they don't include individual STL files for the parts. I saw one on the internet that would work perfectly if I could get everything set up and printed. Your help is appreciated in this matter.

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Fri Sep 10, 2021 11:50 pm

Most projects are essentially re-inventing the wheel these days. It's rare that you can't find some lame implementation of almost any idea you might have.

Here's an example for four pills:
https://create.arduino.cc/projecthub/ma ... ser-07a43f

Here's another one:
https://www.instructables.com/IoT-Pill-Dispenser/

Another:
https://duino4projects.com/the-automati ... enser/amp/

This one does six pills:
https://www.hackster.io/smartypill/smar ... 2-0-d956dc

They all use regular small servos to actuate the pill dispenser mechanism.

There are some examples for stepper motors too.

Probably the pill handling is the most tricky part. Pills are tiny. Some of them are fragile. Some are awkward shapes.

Pharmacies here will pre-distribute your medications in a big blister pack. One blister for each day, or each interval, with the pills contained in the blister, and the date/time printed on the seal. After giving this to the patient there is an obvious paper trail for missed doses, or extra doses taken, or tampering. No power or network needed. No technology required.

The pill dispensers for grandma are a neat idea, but who reloads the dispenser? Who programs the time pattern? What if someone loads pill A into dispenser B? Now grandma gets three times the dosage, which might kill her (or merely be wasteful or ineffective).
Hmm. What can I put here?

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Sat Sep 11, 2021 12:05 am

I've looked into the first one which would work if I could print the parts but it only holds four pills. I really like the last link. There's one other that I will take the link up in post tomorrow if I remember. I have a 3D printer have not designed anything on my own everything that I have printed have been pre-made STL files. This project may be out of my scope but I'd like to give it a go I just don't want to pay hero $29 a month. There was one other option I found that was close to $2,000 for the equipment and no monthly fee.

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Sat Sep 11, 2021 12:25 am

Well, the Hero has a warranty, and might not poison you. If this project is for yourself and you are already struggling with your pill regimen and it helps you then go for it.

When you are done you might look at $29/mo. slightly differently. :)

Fundamentally there's not much to it. You can probably see a lot of commonality in all of the projects. And having a specific requirement in mind is a great way to learn, because you are learning for a reason. I'd suggest that you make a modular design and focus on a single module for dispensing a single pill. Then, if you have 8 different medications, for example, build 8 modules.

The same goes for software. Make it modular. If it tracks one medication properly then tracking 8 just means you make 8 instantiations of your objects or your structures.
Hmm. What can I put here?

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Sat Sep 11, 2021 6:12 am

If I could get the first one in the last one in the individual STL files I could print them out and wouldn't have to do anything else but use their specific code. I'm not worried about poisoning myself because I know what I have to take and what each one looks like.

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Sat Sep 11, 2021 6:21 am

Jolly good. If you need any help just ask.
Hmm. What can I put here?

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Sat Sep 11, 2021 2:04 pm

Can anybody split up an STL file for me if I get a hold of the rest of the code

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Sat Sep 11, 2021 4:14 pm

OpenSCAD will read STL files. You can load one up and use difference() or intersection() to isolate part of the model then export that for printing.
Hmm. What can I put here?

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Sat Sep 11, 2021 8:56 pm

Would anybody be willing to split the files up for me. So that I can print them out. Then I will figure out how to load the software on the raspberry pi. I know openCAD can do that but have no experience with that. Cure is all I know how to use on the 3D printing side of things. Stl file in the first link will not split using cure. The last link has no STL files. Your help would be appreciated again. https://hackaday.io/project/7019-smart- ... -organizer this one has one giant STL file that can be split up. But when I split it up the inside parts don't come out right. I've got the body printed in petg. https://www.thingiverse.com/thing:4743966 this one will not split up. The last one looks like the best option at the moment. If somebody would be willing to donate their time to help me get the last one split up into manageable printer parts I would appreciate it. The printer I have is a monoprice MP10.

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Sun Sep 12, 2021 2:03 am

I'm happy to give it a go, but I've turned all my equipment off as we are expecting a second round of strong winds today. Two days ago we had a lot of damage and power cuts, and we are forecast more of the same today.

Once everything has settled down I'll take a look, although if I can't do it with OpenSCAD I won't be looking for other tools.

In the meantime you have three options.

1 Learn OpenSCAD. There are other design tools, but OpenSCAD is powerful, free of charge, and free of restriction or obligation. If you have Cura and a 3D printer then it might be interesting for you to start designing your own models. OpenSCAD will export STL, which you can slice with Cura and print as you currently do.

2 Wait for someone else to chime in on this thread and lend a hand.

3 Contact the original designers and ask them to export their models in more parts.
Hmm. What can I put here?

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Sun Sep 12, 2021 6:18 pm

I think I found a way to split the file up once I get done can somebody verify using freecad that all the parts are exported and when somebody be willing to remain the part? Then I can start the massive printing task. I believe I have all the parts file ready to be uploaded somewhere so that you guys can look at it in zip format once I get it uploaded I will upload the link. Then you can download the file and verify that all of the parts are exported and rename them accordingly. This is the link to the parts file https://drive.google.com/file/d/1SJ6nU2 ... p=drivesdk Your help would be appreciated again in this matter

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Wed Sep 15, 2021 1:34 pm

I ran into my first hurdle setting up the raspberry pi with the necessary software. When I follow the steps from the smart pill project I get a blank web page. Can anybody set this up fully for me and send me an image. Your help would definitely be appreciated in this matter

User avatar
neilgl
Posts: 3667
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: How to control a 360 servo

Thu Sep 16, 2021 8:47 am

Which project are you using?

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Thu Sep 16, 2021 9:25 am

bob5731 wrote:
Wed Sep 15, 2021 1:34 pm
I ran into my first hurdle setting up the raspberry pi with the necessary software. When I follow the steps from the smart pill project I get a blank web page. Can anybody set this up fully for me and send me an image. Your help would definitely be appreciated in this matter
Everyone would like to help, but it's not how this works. I'm afraid you have to do the work yourself. Unless you have a tame geek nearby who can do it for you, in which case you wouldn't be asking here.

And if this is your first hurdle, you give up too easily.

You have a huge amount to learn, but when you're done, you will know a bunch of stuff. If you don't want to learn, or if it's too hard, just pay $29/month for the commercial solution and don't worry about it.

In order to get help, you need to describe what you are doing, what have you tried, what you expected, and what is different to your expectations. It's a slow process, but there can be so many reasons why something doesn't work. We have to play "Twenty Questions", but the prize is a working project. There's also a possibility that the simplest suggestion could solve a whole bunch of problems at once.

You started with "How to control a 360 servo", but that obviously was not the problem. You should probably have started with "I want to make an automated pill dispenser", which is where we are now.

So, to get on track, please link to the "smart pill project". Please describe what you have done. Please describe what is different to your expectations. Someone will help you figure it out.
Hmm. What can I put here?

bob5731
Posts: 37
Joined: Mon Sep 02, 2019 8:19 pm

Re: How to control a 360 servo

Sat Sep 18, 2021 10:01 pm

https://create.arduino.cc/projecthub/ma ... ser-07a43f

I'm stuck at the point where you install the software on the raspberry pi. I thought this guy's instructions and it gives you a blank page I don't know Jason at all. I haven't figured out how to run a json file yet. I spent several days reconfiguring his steps and they are not clear to me. I've also posted in the raspberry pi forms in somebody over there said it's not as easy as running his code the code on that blog brings you an empty web app.
https://forum.ionicframework.com/t/inst ... p/215147/6

I think I got the 3D portion of this done just got to print the massive project out. All I needed to do is he spent my pills every time I need them I take six to eight different meds a day some twice a day. And use a web app or Android app to control everything.
Last edited by bob5731 on Sat Sep 18, 2021 11:07 pm, edited 1 time in total.

ame
Posts: 3902
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: How to control a 360 servo

Sat Sep 18, 2021 10:16 pm

bob5731 wrote:
Sat Sep 18, 2021 10:01 pm
https://create.arduino.cc/projecthub/ma ... ser-07a43f

I'm stuck at the point where you install the software on the raspberry pi. I thought this guy's instructions and it gives you a blank page I don't know Jason at all. I haven't figured out how to run a json file yet. I spent several days reconfiguring his steps and they are not clear to me. I've also posted in the raspberry pi forms in somebody over there said it's not as easy as running his code the code on that blog brings you an empty web app.
There is no mention of Raspberry Pi in that project. It seems to me that all the code is running in the cloud on Amazon's servers.

And you don't "run" a json file. It is generally just a data file containing information that a program needs. It can be an actual file on your computer, or a temporary file created as a way to interchange data between systems.

I think this project is going to be a great challenge for you.
Hmm. What can I put here?

Return to “Beginners”