Me Micro Switch A - mblock 5


#1

Hi,

I struggle to make the Me Micro Switch A work on mblock 5.
In the picture you will see my system, I’m using the MegaPi board with the RJ25 shield and a RJ25 adaptor on which I plug the Me Micro Switch A.
I’m basically just trying to do a simple code on mblock 5 that would allow an Encoder motor plugged in port 1 to run when the Me Micro Switch is pressed. But why I try doesn’t work…

Am I too naive that this was suppose to work as such? Technically I thought it might.
image
It seems like the software doesn’t recognize that something is plugged in port 6 slot 1 or maybe i’m not supposed to used the “limit switch” condition?

Does someone know what is wrong? I checked that my wiring was similar to some videos I watched, but I may have done something wrong. I’m quite a noob to be honest.

Thank you very much if someone has explanations ! :slight_smile:


#2

Hi Mathis

I’ve done a few experiments with micro switches. The Me micro switch types A and B are both physically the same, with the only difference being their acrylic mounting brackets - and these are not very well documented devices… They are physical limit switches which require only a minimum amount of pressure to activate them and thus trigger a boolean signal to the MegaPi controller.

You need to be aware that Me Micro-Switches have three terminals with very small markings indicating C (Common), No (Normally open) & Nc (Normally closed) and you do need to use a magnifying glass to see them.

The black / white wire (the live wire) should always be connected to the ‘Common’ terminal. The usual usage of this switch dictates that the second (white) wire is connect to the outer ‘Normally closed’ terminal. But do note that if the white wire is connected to the central ‘Normally open’ terminal instead then the boolean values that the switch outputs are reversed.

You need to connect an Me Micro-Switch to an Me-RJ25 Adapter (as I can see that you have done) and choose the correct port and slot in the ‘Makers Platform’ ‘limit switch’ block. When you depress the switch it will indicate that it is working by showing a value (either 0 or 1) in a small bubble above the programming block…

When using the conventional C, Nc wiring connections, then if the output is 0 (false) it shows that the switch has not been depressed and conversely, it shows 1 (true) if the switch is depressed.

Good luck.


#3

Hi CommandeR,

Thank you so much for your kind and detailed reply !
From what you say, it seems like i’m in line with every steps, the only thing that is different is the ‘Makers Platform’ ‘limit switch’ block ! And indeed I anticipated that, however, I have not way to get the ‘Makers Platform’ extension as I am using MegaPi pro device : it doesn’t suggest it in the extension center. Do you know if there is a way to still get it for MegaPi?

Have you used the Me micro Switch in a system with the MegaPi board?

Again, thank you a lot for your kind reply.


#4

Hi Mathis

I have used it on MegaPi. On the Devices tab click the extensions button at the bottom of the blocks palette:

extension

The extensions centre will open and you select and open the Makers Platform:

This will then be added into your blocks palette - click to open the new blocks and the fourth block from the bottom is what you are looking for:


#5

Hi !

And you managed to make the Me Micro Switch work on the MegaPi?
I can see you have the Ultimate 2.0 under the device section, I selected the MegaPi Pro, was I not suppose to do that? - that’s my problem, because with the MegaPi Pro device in, when I click on the extensions button, the ‘makers platform’ extension is not present.

I can now see that when I select the ultimate 2.0 it does suggest the same type of extension + the ‘makers platform’ in this case! Should I use the Ultimate 2.0 instead?

Thanks again for your very fast and kind reply ! :slight_smile:


#6

Yes, use Ultimate 2 - it looks like your board IS MegaPi, not MegaPi Pro so that is the problem I think.


#7

Here is a little script that should illustrate how this works the motor only turns if the switch is pressed: