Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - GoranP

Pages: [1] 2
I have this evening made a simple test, just with two switches, one connected as NC, the other one as NO.
Funny, when I test like this, then it works perfect, for both inputs, both on rising and falling edge, directly in the beginning, No problem.

Anyhow, it means i have something funny in my normal program. I have to investigate more there..

I will do as follows. At my little "machine" I will change the connection of the microswitch from Normal Closed to Normal Open, so it can be "operating".

At the weekend or under next week I try to built up an mini-enviroment so I more easy and properly could test my problem, and also better describe what's happens.

I will come back with more info.
Thanks anyway, so far ...

// Göran

So, I have now tested the beta-firmware. The result is "Yes and No" ...

When I run my software the first time after power on of the Tinkerforge module stack, it function well with the interrupt for the microswitch, (with the Normal Closed contact).

 If I stop my software and run it again, then is it as before, I need to touch the microswitch one time before I active my routin's.
 Do I, for example, make the stack powerless and disconnect it from USB and then reconnect it, then it works directly the first time I run my software.

Another drawback I noticed was, (I downloaded the beta even in my second Digital Input card), for normal open contacts it didn't work well. On these I got the same behavour for a normal open contact as I had for the normal closed contacts. It needed to be tipped twice to get any reaktion, after that it was working more or less as usual..

I have tested these sequences a number of times, to see if I could repeat the problem. And so is it. The patter is the same.
Beta and Normal Closed contact - works the first program run. When restarting the program, I need to tip twice to get an interrupt.
Sorry for the test result ...

I will test it later on this evening and come back with my results..
Thanks in advance ...

I'm using Industrial Digital In 4 Bricklet, the first hardware version and has made my program in Python. My problem is the interupt functionality.

To one of the inputs I have connected a micro switch. Because it act as a limit switch for a stepper motor movement, (the signal is also used for reference settings) I have connected as a Normal Closed. In other word, it means that we have signal at the input in normal case. When switch is actived, then the signal drops.

In my progam I have also a row with myInput.set_edge_count_config(0b1111, 2, 50), as I want interupts on both rising and falling signals.

Whats happens, (or not happens), in my program is that I don't got any responce on the first falling edge of "switch" input. On the second activation of the switch it works as normal.

If I first touch the switch before using the rest of functions in my program, then it works.

For the other inputs I use Normal Open switches, they work as normal directly from the beginning of the program.

So, for me, it seems that the functions, and maybe the firmware, has a problem to handles signals that "High" at start up.

If somebody has a solution for my problem, or could explain what I have missed, please tell me.

// Göran

General Discussion / Re: Quadrature encoder Bricklet
« on: October 08, 2018, 06:51:21 »
I have an equal need, like to use an encoder for positioning.
Of course, there is the Industrial Counter Bricklet, but it not solves the connection to the encoder.

// Göran

In my project I have two stepper motors, and controllers. The control program am I doing in Python.

 It had been very nice to have cam-functions in these modules.
With cam-function I mean a programmable functionality that let me set a position. When these position is passed, in one or other direction, it should trigger a callback function that inform me that we have passed this position and if we are more or less than the given position.

My questions :
- is this something that could be fullfilled without a firmware update?
(I have tried to do this with use of callback_all_data, but it seems to load the system to much.. ).
- Has somebody an idea how to make it nice, with low computer load and fast execution?

Anfängerfragen und FAQ / Re: Empfangen mit dem Remote Switch
« on: September 03, 2017, 18:56:24 »
Hello again.
It have even better if it also where compatible with Nexa units.

Anfängerfragen und FAQ / Re: Empfangen mit dem Remote Switch
« on: September 03, 2017, 18:48:11 »
I agree, the receiving is the missing thing.
It has been wonderful when could be used as a transeiver. Today i have to use a module from RFXcom, but i had enjoyed when i could implemented into my other Tinkerforge modules

General Discussion / Re: Connecting multiple Ethernet Extensions
« on: April 18, 2017, 19:18:11 »
That was very interesting news. I had for a while ago almost the same problem.

I had two Master Brick's, each with a Ethernet module. Each of them had a separate IP-address. No problems to connect to stack 1 or two, it was running good. But starting both the stack's, with two separate Python programs, impossible.
My first idea then was, "I have done some configuration error". Anyhow, there was no time for faultfinding, so i made another solution to solve my problem then. Now I understand why it didn't work ...

After I was reading your last reply's, I took out the 2 Ethernet modules I had in my "spare" boxes.
When testing both of them with Brick Viewer, both of them where showing the same MAC address as you mentioned, (40:D8:55:02:A0:00), not as printed on the labels.

One of these modules was ordered in middle Jan -17, the other one in Febr. -17

// Göran P

Projektvorstellungen und Projektideen / Re: Hexapod + KI
« on: April 09, 2017, 14:32:29 »
Hello. I'm in English, meine Deutsch is nicht so gut""...
I'm interested of the price..


OK, that sounds good. I like your modules and the API for them. But this was things that I found have "space for enhancement".

Under the mean time I have found a solution on my problem in test 2b, startup with no ethernet connection or stack power.

First I tried to to catch the exeption, but I didn't get success.
So I solved it in another direction. Before I try to connect, I check if I have contact with the stack by sending repeating ping's.
When I have contact, I start to open the ipconnection.

I found a module, (, on the net. They say that this module has some limitations, you have to have administratives right in the system. For me has it solved my problem, for the moment. I renamed the module to and added a new function in this module to give me an answer that was eay for me to use.

In my file I added following code before opening the ipconnection.

Code: [Select]

isConnected = False
while isConnected == False:
pingcheck = ping_gp.check_connection_by_ping(ExampleRugged.HOST)
if pingcheck >= 0:
print("The unit [%s] answer in  %0.4f ms." % (ExampleRugged.HOST, pingcheck))
isConnected = True
print("The unit [%s] didn't answer at all !! (AnswerCode %0.1f)..." % (ExampleRugged.HOST, pingcheck))

# Connect to brickd, will trigger cb_connected
self.ipcon.connect(ExampleRugged.HOST, ExampleRugged.PORT)

This is not the smartest or most beautiful solution, but it solved my problem.

// Göran

Sorry, in some way the sorcerer file was not included.
Here it is..

I'm new on Python programming, on the TinkerForge's modules and on API. But I would like to understand was is happening and when.

To be able to understand why things are as they are, I have made a small test project with a StepDown module, a Master Brick and a Ethernet module. The code I have used, is basicly '' with code parts from, and from the API-doc online.
See atteched code :

I have tested in two ways, with USB-cable and with a ethernet connection. In both cases was the stack powered from a external battery pack.

What I want to archive, is a way to handle condition that could occure, like
- the program is started before the stack is ready, (powered up and connected),
- disconnected network, (power loss to the switch), etc.
- power down on the stack,
- etc.

The difference in the test code is the HOST address, in my code block I have 2 definitions for HOST, and I just moved the #.

Testcase (A) - connected through USB (for output results, see Testresult-(A).txt)
I got good responces, and was able to handle almost any case.

Testcase (B) - connected through ethernet (for output results, see Testresult-(B).txt)
The most funny thing here was 2 things:
1. When I disconnect the ethernet cable, OR the stack power, it took always about 25 seconds before I could notice it in the program.
When I reconnect the ethernet or power, it where able to get connected again.

Testcase (B_2) - connected through ethernet (for output results, see Testresult-(B)_2.txt)
In this case was it so, that the stack was not ready, (no ethernet connection or stack power). Hear I got an error and program was stopped.

My questions, for testcase (B) and (B_2) :
A/ How should I do, so the program could handle startup with no initial connection to the stack?
B/ How should I do, to reduce the time before the program notice that it has lost the connection to the stack?

This testproject should be my template for the future project's. More of the upcoming project's will be done with just ethernet connections between stack's and computer(s).

I look forward to your comments and advice's.

// Göran

General Discussion / How to use IPConnection.CALLBACK_DISCONNECTED ?
« on: February 22, 2017, 20:00:47 »
I have a stack with a Step-Down, 2 Master Brick's, Ethernet, and some bricklets, (2 Industrial Dig In, 2 Industrial Dig Out), and a PTC module. I use Python for programming. Connection is OK, the normal function also.

BUT i would like to use the IPConnection.CALLBACK_DISCONNECTED. I have made a callback function, for get a notice that i have lost the connection. When i test it, by remove the network cable from the stack, i don't get the callback.

Any ideas what i could have wrong or missed? Or do i have missunderstand the functionality?

// Göran

Pages: [1] 2