Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hello everybody,

 

I'm working on an industrial special machine and i want to control some part of it with bricklet. My machine can do round trip on a rail with a motor and its coder. the PLC keep the control of all the power, I just send him order with a RS232 bricklet.

For a first test i want to go to 30 000 counts, wait 2 seconds and then go back to my initial position ( 0 ) and repeat forever. Here is the issue : my machine drift in a single direction about some centimeters each time. When I control it directly by the PLC i haven't that and I don't understand why it does it with the counter bricklet.

the coder is a sew eurodriver EH1C, I connect CH0- and CH2- to GND and CH0+ and CH2+ to A & B

Here is my code :

 

from tinkerforge.ip_connection import IPConnection
from tinkerforge.bricklet_rs232_v2 import BrickletRS232V2
from tinkerforge.brick_master import BrickMaster
from tinkerforge.bricklet_industrial_counter import BrickletIndustrialCounter
import time
 
HOST = "localhost"
PORT = 4223
UID = "6eSrKP" # Change XXYYZZ to the UID of your Master Brick
UID_RS = "W9P"
UID_COUNTER = "QV8"
 
ipcon = IPConnection() # Create IP connection
rs232 = BrickletRS232V2(UID_RS, ipcon) # Create device object
counter = BrickletIndustrialCounter(UID_COUNTER, ipcon) # Create device object
ipcon.connect(HOST,PORT)
 
counter.set_counter_configuration(counter.CHANNEL_0,
                                      counter.COUNT_EDGE_RISING,
                                      counter.COUNT_DIRECTION_EXTERNAL_DOWN,
                                      counter.DUTY_CYCLE_PRESCALER_1,
                                      counter.FREQUENCY_INTEGRATION_TIME_1024_MS)
counter.set_all_counter_active([True, False, False, False])
counter.set_counter(0, 0)
 
i = 0
speed = 40
 
while True :
   
    message = [chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(speed),chr(2)] # the first 7 control IR power the 8th the speed and the 9th the direction
    rs232.write(message)
    time.sleep(2)
 
    message = [chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(speed),chr(1)]
    rs232.write(message)
    while counter.get_counter(0)<75000:
        print(counter.get_counter(0))
 
    message = [chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(speed),chr(2)]
    rs232.write(message)
    time.sleep(2)
 
    message = [chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(i),chr(speed),chr(0)]
    rs232.write(message)
    while counter.get_counter(0)>0:
        print(counter.get_counter(0))

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.