SwitchMote Communication

Started by peckcj, January 24, 2016, 02:05:34 AM

Felix

If you wired it right, (TX to RX, and vice versa, common GNDs and VCCs), then when you type anything on one end it should show up on the other end. You have to make sure the ports are not used by anything else, if you're using my image or my setup then you gotta sudo stop gateway to free the serial port. Open minicom like this:

minicom -b 115200 -o -D /dev/ttyAMA0


You can just open serial monitor in the Arduino IDE, same 115200 baud etc. Type something hit ENTER, you should see that in minicom.

peckcj

I have my FTDI adapter plugged directly into the MightyHat FTDI pins and my laptop. I open up the Arduino IDE and open up the serial monitor.

I SSH into the pi and stop the gateway. Then I open up minicom via SSH as well.

I can see the metrics showing up on the serial monitor in the Arduino IDE, and I can also see them show up in minicom via SSH.

When I attempt to send a command from the serial monitor, nothing comes up on minicom. When I type anything in minicom, nothing shows up on the serial monitor.

Felix

That is because if you plug it directly into the MHat FTDI header, then you can only talk to the atmega, ie essentially the FTDI adapter is now in parallel with the Pi serial. So to talk to the Pi instead, you have to reverse RX and TX, so you need to plug it with jumper wires.

peckcj

Got it!! Thanks, Ill give it a shot.

peckcj

I plugged in the FTDI adapter with RX and TX swapped into the MH, then SSHed into the pi, stopped the gateway, then opened minicom.

I typed into the serial monitor and hit send and got nothing on minicom.

Felix

Ok let me try that on my own when I get a chance today and I'll follow up. I want to make sure the theory corresponds to reality.
In any case what you describe is the serial INTO the Pi, which earlier I believe you reported that it works because yon can receive RF messages and through the mega to the pi to the gateway. So that part we know works and the fact that you can't do the same via serial monitor means something is not right somewhere, maybe a connection or something. Let me try this and I'll report back.

peckcj

I removed the MightyHat and installed a Moteino with the gateway sketch on it, and it works fine, with full remote functionality.

It appears that the MH is not communicating properly. Can I send it back to you to check out?

Felix

Sure. Send me an email and I'll get you instructions for sending it back.
Thanks

Felix

I received the Mhat from you.
There is nothing wrong with the MHat. I reflashed it with the sample sketch and default encrypt key since it was different.
I used a Pi with the V8 image.
I used a SwitchMote2x10A with to test it. Everything works. The SM shows in the UI as soon as I press any of the buttons, then I can pick "LightSwitch" for the type and the buttons will become available, pressing one in the UI activates that button on the SMote.
So everything worked on my end. You will need to revisit your settings, load the correct sketch for the Switchmote also. It requires a config sketch to put the radio settings in EEPROM then the actual SwitchMote sketch.
The MigthyHat will be returned to you.

peckcj

Well, thanks for checking on it. It's very strange how the MH isn't working for me, but a regular Moteino is...and they're both loaded with the same exact sketch. I guess the MH will go in a drawer for now.

Felix

I think you should give it another chance. Without your whole setup I cannot do more than I did. I did solder a wire antenna while testing, then removed it.
Everything worked as expected, so ... I really don't know why it doesn't work for you.
Getting to know the code a little better and how the different components interact will definitely help with finding the issue, if any.
The mightyHat you sent is soldered correctly, it worked with a Pi V2 I had, so no issue with the hardware.