Lazarus

Programming => General => Topic started by: jb007 on June 24, 2019, 03:43:12 pm

Title: DATA
Post by: jb007 on June 24, 2019, 03:43:12 pm
Hi,

 had this 16 channel servo controller, it's controlled by RS232.

9600, 8data bits, none parity, 1 stopbit, no flowcontrol.


The software with it is verry limited, just 1 servo at once.
By the slides or a command.

I managed to intersept the data from pc to the pcb by using a logic analyzer.
Played around and understand the code.

Somehow I dont's see the clue to get it in lazarus in the right way.
Tried different things...

Any one a hint?








Title: Re: DATA
Post by: jb007 on June 24, 2019, 03:44:35 pm
software
Title: Re: DATA
Post by: jb007 on June 24, 2019, 03:44:58 pm
from logic analyzer
Title: Re: DATA
Post by: jb007 on June 24, 2019, 03:45:23 pm
how to in Lazarus?
Title: Re: DATA
Post by: tr_escape on June 24, 2019, 03:55:32 pm
Maybe your problem is not on software but hardware?

What device do you using? Is there any document on internet?

Sometimes the Rs232 pinouts can be "pin to pin" on your device.

I used before some modbus devices with lazserial and serbod's "DataPort" package.
Both of them is working.

But also I didn't notice your "received event" or "serial.ReadDate".

Title: Re: DATA
Post by: SymbolicFrank on June 24, 2019, 04:54:16 pm
If you have two RS-232 ports on your PC, you can connect those in between and just relay (and log!) the data. Store a timestamp, or count the pulses. That makes it easy to analyze and steer.
Title: Re: DATA
Post by: avra on June 24, 2019, 05:32:18 pm
how to in Lazarus?
First is bad, should not even compile, and #02 is actually a byte with decimal value of 2.
Second is missing exclamation mark "!" at the end of the string.
Title: Re: DATA
Post by: avra on June 24, 2019, 05:45:39 pm
If you are talking about this device:
https://www.gearbest.com/development-boards/pp_62994.html

then it seams I was right and you were missing an exclamation mark at the end of the string. According to https://github.com/avtehnik/rpi-lcsc-16-servo/blob/master/server.py, you should send something like '#01P2500!'.
Title: Re: DATA
Post by: jb007 on June 24, 2019, 08:33:44 pm




Hi,

Thanks, I understand.


I should have place the code here, what DID compile, sorry for that...
( while I was coding, I made a screenshot for here )

Let's make a new start! :D

First of all, the servo-pcb is working. Using the software delivered by the pcb, one can control a servo,just 1 at a time.
By using the slides or by a command followed by pressing button "Test".


When sending a command from the software:

Like #12P0034! or #05P1234!

what makes servo 12 go to position 0034 ande servo 05 go to position 1234.

This works fine!


I intercepted some comands by a logic-analyzer, as you can see in picture below.
The logic analyzer shows what had been send in terms of e.g. 0x23


Now, I want to send this with Lazarus.
Got al the com setting the same as in the software delivered by the pcb.

After watching some commands with their results in the logic-analyzer, it's clear to me how the command is being transmitted, see picture.

But, ( off caurse  ;)  ) now I'm writing this I understand I have to connect the logic analyzer again so I can see what Lazarus is sending ( or not ).

In my tests I allready had only 1 program at once using the comport ( com3 in my case ), so there's no issue between lazarus or the software delivered by pcb.


 















Title: Re: DATA
Post by: jb007 on June 24, 2019, 09:17:47 pm
Nice, this makes sence...

Somehow, in the first place I was confused by the way the data was shown in the logic analyzer... %)

Title: Re: DATA
Post by: jb007 on June 24, 2019, 09:26:34 pm
It works!

I purchasd this pcb for my RC truck.

( I allmost designed a servo pcb myself using an arduino, but it's ok now! )

Thanks for your time.



OFF TOPIC:


Recently I finished my prototype 3D-fpv camera.
There's no Lazarus involved but it has a microcontroller and MikroPascal.
The basic idea of htis 3D-fpv comes from internet, but I worked from bottom up myself bouth hardware and software.


Here you can see it:
https://www.dronetrest.com/t/some-introduction/6706

Meanwhile, I'm working on V2.0...


Kind regards!


Title: Re: DATA
Post by: jb007 on June 24, 2019, 09:32:48 pm
OFF TOPIC nr2:


Building RC truck, flatbedloader, excavator and DIY transmitter/receiver-setup.

For those interrested:
( sorry , these projects I have only at Dutch forums, but one can watch pictures and videos );


Truck:
(  flatbedloader not started )
https://www.modelbouwforum.nl/threads/bouwverslag-5-assige-trekker-met-dieplader.263256/


Excavator:
https://www.modelbouwforum.nl/threads/project-elektro-hydraulische-cylinders-graafmachine-huina-1550-ombouwen.261643/



Transmitter/receiver:
https://www.modelbouwforum.nl/threads/bi-directioneel-rc-control-zelfbouw-verslag.263922/






Title: Re: DATA
Post by: jb007 on June 24, 2019, 09:40:33 pm
Some extra info!
I purchased this pcb '├žause it got RS232.
There are lots of servo pcb's based on I2C, but I don't manage that to work on Aruino by using bit-banging...

Have a nice evening!
Title: Re: DATA
Post by: jb007 on June 25, 2019, 10:29:38 am
Last but not least...

Now, I do understand my misinterpretation of the data e.g, 0x32 

"What is that '3' doing next to the '2'?

It was just ASCII... :D

An not some special constructed code by the software!

Have a nice day



Title: Re: DATA
Post by: jb007 on June 30, 2019, 10:16:00 pm
So excited!

Jumped into schematic/pcb-design.

This opens new doors!

So far, so good! This toppic is done...


Title: Re: DATA
Post by: jb007 on July 23, 2019, 10:55:16 pm
For those interested, see here some results:

The 16 channel servo board is connect to pc by seria, there's no Arduijno involved.


- 16 trackbars to control a single servo, by channel.

- Truck and flatbedloader control.
 
  Control a single axle to steer and/or raise/lower.
  Steer: the angle of axle[00,01,02] as function of ( position of the axle and position of the steer )
  Disc:   the angle of axle[05,06,07] as funcion of ( length of the flatbedloader, angle the disc and position of the steer )


Angle of the disc: a poteniometer at ADC microcontroller.
( In the software simulated by a trackbar )

When moving steer- or disctrackbar: the included 3 trackbars are moving also on the screen.



https://www.youtube.com/watch?v=zBuuBhOTmRE&feature=youtu.be