{"id":188,"date":"2022-07-25T19:10:09","date_gmt":"2022-07-25T19:10:09","guid":{"rendered":"http:\/\/bechele.de\/?page_id=188"},"modified":"2022-09-23T13:37:01","modified_gmt":"2022-09-23T13:37:01","slug":"the-readme-file-from-the-package","status":"publish","type":"page","link":"https:\/\/bechele.de\/?page_id=188","title":{"rendered":"The Readme File from the Package"},"content":{"rendered":"\n<p>In following you see the readme file contained in the directory \/usr\/local\/bin in the images or in the tar ball.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">This is the documentation to project bechele.de\nFurther infos under www.bechele.de\nAuthor Rolf Jethon\n\nbechele,de is a Raspberry Pi project, that enables you to create movement models\nlike hand puppets, dance puppets or animal robots with simultaneous output of\naudio data and awake it to life, without the need of programming.\n\nInstead of a Raspberry Pi a OrangePi PC can be used - therefore a separate SD\ncard image exists.  \n\nAll required project scripts reside in folder \/usr\/local\/bin.\n\nBasics\nTo move a movement robot syncronized to music or speech, it is required to add\nthe movement in some way according to the tone. In this project this happens by\nmoving a joystick by hand synchronous to the sound. At the same time the \nmovements will be output to the servos to be able to check the results on the \nfly. The number of recording channels is limited to a maximum of 16 according\nto the project. In case of the puppet Mr. Bechele, the number of Servos in use \nis only 4. This limitation is just coincidencial and not a limit for other \nprojects. One servo for the eye movement up-down, one for eye movement \nleft -right, one servo for the lid movement and one for the mouth movement.\nMy new puppet (almost finished) uses 8 channels for example. Because with a\njoystick only two channels can be recorded, the recording of all channels need\nto be done sequentially. In case of Mr. Bechele I recorded first the mouth \nmovement according to the speech audio mp3 file. Because mouth movements are \nvery quick they need full concentration to acieve a more or less accurate\nresult. Therefore I just recorded one channel only though I had two channels\navailable. Then I recoreded the eye lid movement with also only one channel. \nFinally I recorded the eye movement with two channels at the same time. The \naudio data was divided in single short sections, to allow the puppet player to\nrespond in the speech pauses. After finishing recording, audio data and movement\ncan be output step by step by pressing a button, so that the audience has the \nimpression the puppet talks really to the puppet player. \n  \nWorking principle:\nA movement set consists always of a mp3 sound file, and a .svo file that\ncontains the movement information for the servos. Optionally a text file with\nthe same name may exist, that contains text hints for the puppet player - in case\nyou don't want to learn all the dialogs by rote. This text will then be shown on\nthe terminal window, you started the program from. \n\nIn the first version of the project, the positions of the joy stick were passed \ndirectly to the servos. There the value range of the joy stick needed to \ncoincide exactly with the servo position values. This had the following\ndisadvantages:\n- The whole movement range of the servo needed to be possible for the servo.\n- Different servo types could not be combined if the parameters differed.\n- After changing mechanical parameters of a servo or joy stick, a mecanical\n  re-calibration was required.\n- Mechanical changes required a re-recording of the concerned movement.\nTherefore joy stick movements as well as servo movements will be parametrized\nand normalized to a range of 0 to 4096 in file ConfigL.pm. If for example a \nmouth movement of a puppy was realized, so that 2\/3 of the possible angle range\nof the servo was in use and after a mechanical change just the half of the \nangle range is needed, existing movement file can be re-used without any change,\nby adapting the servo parameters. The same applies if the joy stick changes.\nThe positions of 0 to 4096 in a movement file contains the complete possible \nmechanical movement range of the servo in the model. In other words: The servo\n-despite parametrized correctly- does never try to exceed its mechanical \nlimits in the model.\n\n------------------------------------------------------------------------------\nInstallation:\nThe easiest way is to write a pre-defined SD card image to a SD card and you are\nalmost ready to go. For those who want to install themself, expect a time \nconsuming installation marathon:\n\nUnpack the tar ball into \/ (root) of your distribution.\nDepending on the linux distribution some software needs to be installed.\nHow to install that depends on the distribution.\n\nyou need:   \n   cpanminus (required)\n   WiringPi (required for RaspBerry Pi)\n   git (required for OrangePi)\n   make (required for OrangePi)\n   gcc (required for OrangePi)\n   WiringOP (required for Orange Pi - install with:\n      git clone https:\/\/github.com\/zhaolei\/WiringOP.git -b h3\n      after that > cd WiringOP &lt; und anschlie\u00dfend > .\/build &lt;)\n      now > echo '\/usr\/local\/lib' >> \/etc\/ld.so.conf.d\/randomLibs.conf &lt;\n      and > ldconfig &lt;\n      test with > gpio readall &lt; all gpios should be displayed\n      )\n   alsa-utils (required)\n   mpg123 (required)\n   i2c-tools (required)\n   perl 5 (probably pre-installed - required)\n   perl-device-serialport (required)\n\nFurther you need to install some perl modules - easiest is to use:\ncpanminus \nMany modules depend on other modules, so that the installation may take a while.\n\n PERL MODULES:\n   strict\n   Device::SerialPort\n   Curses::UI\n   WiringPi::API (Version 1.05 - for Orange Pi PC the latest version does not \n   work);\n   File::Find::Rule\n   Device::PWMGenerator::PCA9685\n   Audio::Play::MPG123\n   Time::HR\n   ConfigL (This comes along with the tar ball and does not need to be installed)\n\nAfter the installation, some parameters need to be set - see section \nconfiguration.\n\n------------------------------------------------------------------------------\nProgramms and their function:\n\ntrackui.pl:\n  This program processes on demand all mp3 files from the directory that has\n  been passed as parameter during program start. To ease the use a quasi \n  graphical user interface is in use (curses), that also works over a terminal\n  program (for example putty). \n  \n  Depending on complexity of a model or a puppet, movements will be generally \n  aquired sequentially. Probably nobody may control all servos simultaneously \n  so a correct movement results.\n  By using the user interface it's possible to combine movements. For example\n  several servos may execute the exactly the same movement. The movement \n  control of a servo group may be assigned to a joy stick axis. This is for \n  example necessary if a puppet has seperate servos for each eye lid. You don't\n  want to record each lid seperately but record them togehter because they \n  almost move together. If for an exception one lid shall be moved different\n  from the other, you may record one eye lid in a subsequent record cycle by\n  just defining a limited range, instead of the complete number of movement\n  steps within a single MP3 file. Depending on the number of servos and the \n  complexity of your movements, you may repeat recording as often as you like    \n  with servos activated or de-activated as you need until the movement fits to\n  the sound as desired.\n   \n  control elements of trackui.pl:\n  Section File:\n  Here you define the file (.svo) to process. Usually you will process the \n  files defined by selecting a folder as a program start parameter. \n  With &lt;&lt; Prev Next >> you may move through the folder. The requirement is alway\n  a existing MP3 file. For this file a belonging .svo file will be created or\n  modified. If a .svo file already exists this may be output or modified.\n  With the double arrows you may move in steps of 10 files. This is helpful if\n  you want to navigate to a desired file quickly, because solution dependent,\n  processing single files may be impossible or pedestrian. \n  Save saves the .svo file finally.\n\n  Operation elements on the joy stick:\n  Key right: starts recording or viewing (trigger).\n  Key left: stops recording and returns to the menu.\n\n  Section Channel X:\n  Here you may activate the servos, that shall be recorded during the cycle by\n  moving the joy stick X-direction. This is almost only one servo, but several\n  may be selected. These will then be moved and recorded simultaneously.\n\n  Section Channel Y:\n  Like Channel X, but here the Y-direction of the joy stick will be used for \n  controlling.\n\n  Track Sets:\n  A track contains all movement steps that corrospond to a mp3's play duration.\n  In the default setting, movements will be recorded every 50 ms. A 20 second\n  MP3 results then in 400 movement way points. \n  Start at set: Is the start time of a record in steps of 50 ms. \n  Stop at set: Is the stop time in 50 ms steps.\n  The Check box Update activated controls that after the very first record in\n  a new MP3 the time points will be automatically determied and updated.\n  The Check box Full range allows independent of the fileld values to record or\n  view the complete movement duration.\n\n  Status:\n  Here useful program messages will be shown.\n\n  Process:\n  Record starts a recording according to the servo activation. Not activated\n  servos will be played only. All servos de-activated is the same like 'view'\n  View outputs a MP3 and movements only.\n  \n  The program exits with Ctrl-Q\n\nlive.pl\n  This program outputs during the presentation the sound along with the \n  recorded movements. The sorting of the files follows the ASCII sequence.\n  \n  The program will be only controlled using the four buttons of the control\n  button. The joy stick is not needed and normally disconnected.\n\n  Button 1 :\n  Start of the first sequence or switching to the next sequence.\n\n  Button 2 :\n  Start of the previous sequence\n\n  Button 3: \n  Repeats of the previous sequence with output of the repeat prefix sequence \n  from folder \"repeat\" of the output directory. If more than one sequence \n  resides there the following sequence (mp3 file) will be uses as a prefix.\n  The idea is to have a possibility to repeat a sequence if it was for example\n  too loud in the audience to understand.\n\n  Button 4 :\n  Outputs the next sequence in folder \"extra\" of the output directory. \n  If several sequences are stored there, with each repeat the following sequence\n  will be output. Folder extra  may be just a laugh or a reaction sequence to the \n  audience.\n\nservokalib.pl (2-channel) and servocalib-single (1-channel) \n  This program is used for a first test of new servos and to deteermine the\n  servo and joy stick parameters. It is more or less self explaining. Here you\n  need to have the joy stick connected.\n\n  Operation elements on the joy stick:\n  Key right: switches the joy stick to the next servo.\n  Key left: switches the joy stick to the previous servo.\n \n\nX-pos(0-4096)   |Y-Pos(0-4096)  |Joystick X |Joystick Y |Servo 0    |Servo 1\n-----------------------------------------------------------------------------\n2714            | 1602          | 460       | 317       | 438       | 307\n\n  In file  Modules\/ConfigL you need to enter the limits - see the hints in the\n  file itself.\n\nbackup\n  Shell script that saves the actual configuration as a tar ball in: \n  \/usr\/local\/backup \n\nactivate_autostart\n  running this once under Archlinux, the program live.pl will be started\n  automatically after booting. This is helpful if no terminal is connected to\n  the raspi.\n  runs only on distributions that support systemctl.\n\ndeactivate_atostart\n  De-activates the automatic boot into live.pl \n  \ncksum\n  helper file that checks the file integrity of .svo files.\n\nRecord tips:\n  Create your audio files with a longer silence at the end. So the puppie may\n  continue to move while the puppie player responds. When the button for the \n  next sequence will be pressed, the current will be stopped immediately and \n  the subsequent one starts. Better record the model movements a bit longer, so\n  the puppet does not look \"static\" in speech pauses. \n\n------------------------------------------------------------------------------\nConfiguration:\nAfter installation parameters perhaps need to be modified, before you may start\nwith playing or recording. \n\nSetting up program parameters:\nSerialport ($serialport) - According to the hardware in use.\ni2c port ($i2cport) - According to the hardware in use.\ni2c Adresse ($i2c_address) - According to the address in use. (tip: detect with\n                             i2cdetect )\n\nSetting up the number of servos in use:\nEdit file: \/usr\/local\/bin\/Modules\/ConfigL.pm\nChange the entry:\n$num_servos=4;                      # number of servos in use (max 16)\nOf course you need these Servos attached.\n\nSetting up the joy stick.\nAssume a joy stick delivers at minimum position a value of 123 and 855 at\nmaximum. By entering these values into ConfigL.pm, these values will be\nconverted internally into 0 to 4096. If you move the stick to minimum a inner\nvalue of 0 will be used and if the stick goes to maximum a inner value of 4096.\nAdapt in ConfigL values:\n   $joystick_x_start $joystick_y_start $joystick_x_end $joystick_y_end\n\nSetting up a servo:\nWith servos we have the following parameter sets:\n1. The whole possibe movement range of a servo (not mounted in the model).\n   This is used to parametrize the servo type so when running servocalib.pl,\n   the servo is already preset and reacts accordingly.\n   (servolimit start + servolinit end)\n2. The possible movement range within the model.\n   This is used to limit the servo movement inside the model in its mechanical\n   limits, so the servo does not try to overrun the mechanics. \n   (servostart + servoend)\n3. The movement direction. (1 or 0).\n   O outputs the movement like the joy stick.\n   1 inverts the movement opposite to the joy stick \n3. Servolabel: Here you may enter a text that later names the servo in trackui.pl\n\nTips for setting up:\n- In any case prevent the servo from trying to exceeds its mechanical limits. \n  Especially cheap servos like SG90 don't appreciate that and burn trough.\n- First set up the joy stick using servocalib (without connecting servos) and\n  then set up ConfigL.pm. Check in a second run, if you reach 0-4096. \n- Only then connect !one! servo, put the stick to the middle, determine the\n  limits and enter them into ConfigL.pm.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In following you see the readme file contained in the directory \/usr\/local\/bin in the images or in the tar ball. This is the documentation to&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":73,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-188","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/bechele.de\/index.php?rest_route=\/wp\/v2\/pages\/188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bechele.de\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/bechele.de\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/bechele.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bechele.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=188"}],"version-history":[{"count":1,"href":"https:\/\/bechele.de\/index.php?rest_route=\/wp\/v2\/pages\/188\/revisions"}],"predecessor-version":[{"id":189,"href":"https:\/\/bechele.de\/index.php?rest_route=\/wp\/v2\/pages\/188\/revisions\/189"}],"up":[{"embeddable":true,"href":"https:\/\/bechele.de\/index.php?rest_route=\/wp\/v2\/pages\/73"}],"wp:attachment":[{"href":"https:\/\/bechele.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}