Jump to content
 

Much cheaper servo control for points


Grinkle
 Share

Recommended Posts

all this techie talk is nothing to worry about

I suspect that refers to my contributions. However I have 3 working programs that use Python, HTML CSS and Javascript so I am not blowing hot air

 

 

all that is missing is the glue that makes it work

that is coming soon

For some definition of "soon"

 

...R

Link to post
Share on other sites

please see post #59

Part 3

A, setup

Just had a look at this, means very little to me.

Doesn't seem to answer my questions at all.

'pulse_length' seems to be redefined several times, probably helps if you know what language it is written in.

Personally I don't like using high level languages for this kind of direct hardware control.

Link to post
Share on other sites

Some of the replies are a bit negatively aggressive in tone.

If you can't add anything positive just shutup.

The OP has not been taking a blind bit of notice of the advice he has been getting nor has he been answering the questions that have been put to him.

 

...R

Link to post
Share on other sites

  • RMweb Premium

The OP has not been taking a blind bit of notice of the advice he has been getting nor has he been answering the questions that have been put to him.

 

...R

I think it's called "vapourware" - the stuff dreams are made of! :jester:

 

Keith

Link to post
Share on other sites

I have attached two files

In order for this to work properly both files must be saved to the same folder and the file button.txt must be renamed button.css

 

RMweb will not allow css files to be sent so I am sending it in plain text

This will allow you to look at it and see if it contains any malicious code

 

When the files are downloaded and the file renamed open the button7.html file

 

It will open a tab in your browser and display 8 buttons (there should be 2 columns of 4 buttons with blue backgrounds)

 

you should see a number at the bottom this number will change as you click the buttons (try it)

 

the number is the data that needs to be stored in a data file so the program know's the position for the servo's

this should also be read at startup so the buttons don't go back to main every time you open the page

 

button7.html

button.txt

Link to post
Share on other sites

  • RMweb Premium

Sure NinOz's comment was aimed at me. I didn't intend it to be aggressive, I'm just a bit bemused that Robin's (among others) been giving really decent advice, and it's been met with hostility. The OP doesn't really seem to have a solution, nor to quite understand the issue he's having (or at least not be able to eloquently explain it), and yet his post was wonderfully condescending; to paraphrase "don't worry about all this difficult stuff us grown ups are talking about, it's very easy".

 

As a user of both Arduinos and servo point control I'm a very interested observer - Robin's clearly got more to input than I can.

I wish the OP luck, but this still appears to be a 'help me' thread masquerading as a 'I have a great idea like nothing you've ever seen' thread, which is just a bit curious.

 

That said - I do indeed get a webpage with buttons I can click on to change from "main" to "branch", can I suggest you change the wording to closed/thrown or something more conventional - points may not just be diverging between a main and a branch route. So that's a start...

Edited by njee20
Link to post
Share on other sites

  • RMweb Premium

Sure NinOz's comment was aimed at me. I didn't intend it to be aggressive, I'm just a bit bemused that Robin's (among others) been giving really decent advice, and it's been met with hostility. The OP doesn't really seem to have a solution, nor to quite understand the issue he's having (or at least not be able to eloquently explain it), and yet his post was wonderfully condescending; to paraphrase "don't worry about all this difficult stuff us grown ups are talking about, it's very easy".

 

As a user of both Arduinos and servo point control I'm a very interested observer - Robin's clearly got more to input than I can.

I wish the OP luck, but this still appears to be a 'help me' thread masquerading as a 'I have a great idea like nothing you've ever seen' thread, which is just a bit curious.

 

That said - I do indeed get a webpage with buttons I can click on to change from "main" to "branch", can I suggest you change the wording to closed/thrown or something more conventional - points may not just be diverging between a main and a branch route. So that's a start...

 

Points are normally numbered and lye either Normal or Reversed.

Link to post
Share on other sites

the number is the data that needs to be stored in a data file so the program know's the position for the servo's

this should also be read at startup so the buttons don't go back to main every time you open the page

Forget about the second part (the bit in blue) for now. Leave it to one side until you have the first part working.

 

You have figured out the javascript needed to produce a number for each button. Next you need to learn how to use javascript to send a GET request back to the server. And you will find that much easier if all of your buttons call a single myFunction() and pass it a parameter to let it know which button was pressed - rather than having a different function for each button. The w3schools website (which I mentioned earlier) has lots of tutorials on web programming - HTML, CSS, javascript etc. To give the best user experience you may wish to learn about AJAX

 

Then you need to figure out how to make a webserver that can {A} serve your basic HTML page and {B} respond to the GET request when the user presses a button. As I have said already the Python Bottle web framework makes that easier than anything else I have encountered.

 

...R

Link to post
Share on other sites

I wish the OP luck, but this still appears to be a 'help me' thread masquerading as a 'I have a great idea like nothing you've ever seen' thread, which is just a bit curious.

 

I couldn't agree more.  I only looked at this thread because I'm looking to control points on a layout that is under construction.  Solenoids are out, so for me its a choice between a stall type motor or a servo controlled solution.  A cheaper servo solution would be of interest (hence why I first looked at this thread), but personally, I'd rather pay a bit more for something that works out of the box than spend a long time learning a new computer language and trying to make something work.  I'm assuming that the OP likes the challenge.

Link to post
Share on other sites

You are quite correct I intend to do the bit in blue l8r

 

As I pointed out earlier my coding is terrible

so I am sure you a right about there being an easier way to write the buttons

 

there are some parts that i can not change

The library file that is available to drive the hardware is in python

python natively supports json

 

 

JSON: JavaScript Object Notation.

JSON is a syntax for storing and exchanging data.

 

                            w3schools

Link to post
Share on other sites

there are some parts that i can not change

The library file that is available to drive the hardware is in python

python natively supports json

Nothing I have suggested prevents you from doing that.

 

...R

Link to post
Share on other sites

Solenoids are out, so for me its a choice between a stall type motor or a servo controlled solution.  A cheaper servo solution would be of interest

 

If you want really cheap you only need a couple of pulse generators driving as many servos as you like. You select which pulse stream a servo gets with a single pole switch. Snag is all the servos will throw about the same amount and you'll have to use some sort of mechanical connection between the servo and the turnout that takes that into account.

Link to post
Share on other sites

I couldn't agree more.  I only looked at this thread because I'm looking to control points on a layout that is under construction.  Solenoids are out, so for me its a choice between a stall type motor or a servo controlled solution.  A cheaper servo solution would be of interest (hence why I first looked at this thread), but personally, I'd rather pay a bit more for something that works out of the box than spend a long time learning a new computer language and trying to make something work.  I'm assuming that the OP likes the challenge.

There are plenty of solutions using Arduino or PIC microprocessors, MERG does a range of kits for the latter which are not dear, even including a year's membership.

For Arduino, Njee20 above says he is a user so you can ask for advice there.

Regards

Link to post
Share on other sites

how does the RPi talk to the control device (Smart phone, Tablet) without adding extra software?

 

I am happy to be corrected but I thought I had all the parts (hardware & software)

and was only lacking the knowledge  of how to write the code that glues them all together

It seams I don't gain anything if I change the hardware or software to something I am not familiar with

 

the code that I can not do, Is still the code I can not do

 

BTW the comments here are not aimed at robin who has made some excellent suggestions

I have/had already looked at the w3schools tutorials

perhaps some one else can explain them to me so we can move on

Link to post
Share on other sites

I'm sorry but I don't see how I can help any further. Your questions in Reply #119 suggest to me that you need to learn a huge amount of supporting material before you can implement your servo project.

 

 

...R

Link to post
Share on other sites

You really need to go read other tutorials about all this stuff - Google knows everything.

 

In the example you quoted the text in JSON format is

{ "name":"John", "age":31, "city":"New York" }

 

and the lines

var myObj = JSON.parse(myJSON);
document.getElementById("demo").innerHTML = myObj.name;

enable you to pick out the elements. Try changing myObj.name to myObj.age and see what happens

 

The whole purpose of the w3Schools style is to enable you to learn by experimenting.

 

Don't get hung up on JSON. You don't have to use it.

 

...R

Link to post
Share on other sites

Today I have found out how to write data to a file

this is not 100% solution

there are many reasons why this would not be desirable/allowed on most systems

but this closed system could make most of the reasons irrelevant or preventable

 

One step closer

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...