Author Topic: Pi/Base Moteino problem  (Read 4939 times)

griiker

  • NewMember
  • *
  • Posts: 15
Pi/Base Moteino problem
« on: December 10, 2018, 10:39:42 PM »
Hi:

Im having trouble with my Pi and gateway Moteino.  I am new at this, and have had trouble understanding the instruction with programing the Moteino and raspberry Pi.  I have them programmed, however, I can't seem to get them to work, and I have no Idea what to do next.

I am able to get the Pi Gateway to open through the IP adress in my web browser (Mozilla Firefox), however,  there aren't any nodes.  The LED next to the A2 will light for a couple of seconds, then blink off, and the TX/RX LED will blink a bit then go dark.  I am certain the correct sketches are properly loaded, and the gateway to  Moteino serial is set to /dev/ttyUSB0.  (The instructions were not clear on what number I should use after the "USB" so i put 0.

any ideas?

HeneryH

  • Full Member
  • ***
  • Posts: 229
Re: Pi/Base Moteino problem
« Reply #1 on: December 11, 2018, 07:40:20 AM »
I've built a few systems and there is always a little bit of voodoo magic that need to happen to get the gateway to register new nodes.

It all comes down to whether the gateway Mote is communicating with the device Motes and whether the gateway Mote is successfully sending its messages to the gateway.js server via the serial port. [edit - oops, I see that you are using USB rather than serial]

Some of the voodoo magic for me is just getting the serial port set up correctly than making sure the web configuration has the right baud rates.
« Last Edit: December 11, 2018, 08:09:16 AM by HeneryH »

sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: Pi/Base Moteino problem
« Reply #2 on: December 11, 2018, 07:52:41 AM »
@griiker,

Run the following command to see what port the USB is on;

Code: [Select]
Dmesg | grep ttyUSB

Are you using the PiGateway sketch?   What type of node(s) do you have installed?

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #3 on: December 11, 2018, 08:15:27 PM »
Code: [Select]
Dmesg | grep ttyUSB

got me this:

bash: Dmesg: command not found.

I'm trying to connect a garagemote.


TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: Pi/Base Moteino problem
« Reply #4 on: December 11, 2018, 08:22:15 PM »
Lower case 'dmesg'...

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #5 on: December 11, 2018, 08:46:03 PM »
did lower case

got bash: dmesg: command not found

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #6 on: December 11, 2018, 08:48:09 PM »
BTW I've got the PiGateway sketch running

sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: Pi/Base Moteino problem
« Reply #7 on: December 11, 2018, 09:04:07 PM »
Sorry I didn't catch that typo.. 

So with the GarageMote you will probably have to go out and cycle the door garage door open or closed or go to terminal and send a OPN or CLS message to that node before you see it in the Dashboard.

sparky

  • Sr. Member
  • ****
  • Posts: 296
  • Country: us
Re: Pi/Base Moteino problem
« Reply #8 on: December 11, 2018, 09:05:32 PM »
did lower case

got bash: dmesg: command not found

Did you use caps  for USB?

« Last Edit: December 11, 2018, 09:16:35 PM by sparky »

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #9 on: December 11, 2018, 09:12:45 PM »
I tried using caps for USB, didnt work the first time, but now I got:

[   3.192780} usb 1-1.5: FTDI USB Serial Device converter now attached to ttyUSB0.

However, I also have a mouse plugged into a USB port

I'm asssuming the "FTDI" indicates it is refering to the Moteino, is this correct?



griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #10 on: December 11, 2018, 09:17:38 PM »
I haven't installed the hard ware yet, just simulating by moving magnets close to the Hall Effect Devices.  They are showing a response in the Arduino  serial monitor, so I know that the sketch is properly installed in the garage mote.  but I do not see anything in the web site.

Jason

  • Jr. Member
  • **
  • Posts: 57
Re: Pi/Base Moteino problem
« Reply #11 on: December 11, 2018, 09:30:34 PM »
1. Is the network ID on the moteino and the garage mote?
2. Is the device ID for the moteino connected to the gateway: 1?
3. Is the device ID for the garage mote not one, like 2?
4. Same encryption key for both?

Jason

  • Jr. Member
  • **
  • Posts: 57
Re: Pi/Base Moteino problem
« Reply #12 on: December 11, 2018, 09:34:17 PM »
Hi again, Do you mean to say that the moteino connected to the pi is receiving data from the garage mote, visible on an arduino also viewing the moteino serial port?

Jason

  • Jr. Member
  • **
  • Posts: 57
Re: Pi/Base Moteino problem
« Reply #13 on: December 11, 2018, 09:39:20 PM »
Also: How is the moteino connected to the raspberry pi? What pins?

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #14 on: December 11, 2018, 11:15:22 PM »
Hi again, Do you mean to say that the moteino connected to the pi is receiving data from the garage mote, visible on an arduino also viewing the moteino serial port?

I do not know if the moteino connected to the raspberry pi is receiving
 any data from the garage mote. how can I check for that?  there must be a way I can do that through the raspberry pi itself.

When I connect the garagemote with moteino, I test the relay, and it works.  when I hold the magnet close to the Hall effect device,  I get door open/closed depending on which HED I hold it to. 


in other words, I am checking the performance of the garage moteino by connecting it to a computer runing the arduino IDE/ serial monitor, not through Raspberry Pi.

Right now, I am getting the IoT Dashboard screen, but now it shows this message:

 " Waiting for socket connection.. "



griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #15 on: December 11, 2018, 11:19:11 PM »
Also: How is the moteino connected to the raspberry pi? What pins?

I'm using a USB.  I went into the settings file and changed the serial value setting from "/dev/ttyAMA0" to "/dev/ttyUSB0"

.  I also enabled SSH.

I checked the settings for Node ID, encryption Key, etc and they match where they need to and not where they should not.


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Pi/Base Moteino problem
« Reply #16 on: December 12, 2018, 09:02:23 AM »
"Waiting for socket" means there's another problem.
Check the gateway/logs/gateway.sys.log for errors.

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #17 on: December 12, 2018, 10:14:13 PM »
Okay:

The waiting for socket problem has been corrected. 

I have reinstalled the Raspberry Pi gateway,  enabled SSH, set the serial to ttyUSB.  and I continue to have the same problem,
 my networking settings are below, so what can I fix?:

For the Moteino connected to the garagemote:


 //**** IMPORTANT RADIO SETTINGS - YOU MUST CHANGE/CONFIGURE TO MATCH YOUR HARDWARE TRANSCEIVER CONFIGURATION! ****
//****************************************************************************************************************
#define GATEWAYID   1
#define NODEID      11
#define NETWORKID   100
//#define FREQUENCY     RF69_433MHZ
//#define FREQUENCY     RF69_868MHZ
#define FREQUENCY       RF69_915MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
#define ENCRYPTKEY      "sampleEncryptKey" //has to be same 16 characters/bytes on all nodes, not more not less!
#define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!


Here are the settings for the moteino connected to the Raspberry Pi:


//****************************************************************************************************************
//**** IMPORTANT RADIO SETTINGS - YOU MUST CHANGE/CONFIGURE TO MATCH YOUR HARDWARE TRANSCEIVER CONFIGURATION! ****
//****************************************************************************************************************
#define NODEID          1 //the ID of this node
#define NETWORKID     100 //the network ID of all nodes this node listens/talks to
#define FREQUENCY     RF69_915MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
#define ENCRYPTKEY    "sampleEncryptKey" //identical 16 characters/bytes on all nodes, not more not less!
#define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
#define ACK_TIME       30  // # of ms to wait for an ack packet


Jason

  • Jr. Member
  • **
  • Posts: 57
Re: Pi/Base Moteino problem
« Reply #18 on: December 13, 2018, 01:21:08 AM »
So you are now past the waiting for socket connection. And now your problem is that the garage moteino isn’t showing up in the gateway app.

Is this correct?

Jason

  • Jr. Member
  • **
  • Posts: 57
Re: Pi/Base Moteino problem
« Reply #19 on: December 13, 2018, 01:26:35 AM »
I was unable to see any problems with your code. It looks properly set up.  Do have the PiGateway code running on your moteino connected to your pi or the Gateway app code?  The correct one is the PiGateway code.

I just checked and the default network ID for the Gateway app is 100 whereas the PiGateway app is 200.  So am am guessing you have the wrong program installed on the moteino connected to the pi.  Note: you can change the network ID to 100 for the PiGateway code.
« Last Edit: December 13, 2018, 01:31:24 AM by Jason »

HeneryH

  • Full Member
  • ***
  • Posts: 229
Re: Pi/Base Moteino problem
« Reply #20 on: December 13, 2018, 07:54:50 AM »
Disconnect the Gateway Mote from the Pi and use the serial port monitor in the Arduino Programmer to check the debug statements coming from the Gateway Mote when you interact with the magnets.  Make sure the two Motes are talking together properly first then move on to the Pi.

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #21 on: December 13, 2018, 08:24:51 PM »
Thanks for the help thus far.

I've got the PiGateway code loaded onto the moteino connected to the raspberry Pi, and the Gateway app loaded onto the raspberry Pi.I've noticed that when I plug the Pi Moteino into the a power sources, the red LED will blink for approx. 3-5 seconds, then reamian stead for a few seconds and then go out entirely.  isn't it suposed to remain lit?

I'm starting to think this may be a hardware issue, ie. faulty moteino.

Here is what I have set in the PiGateway code:

#define NODEID          1 //the ID of this node
#define NETWORKID     100 //the network ID of all nodes this node listens/talks to
#define FREQUENCY     RF69_915MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
#define ENCRYPTKEY    "sampleEncryptKey" //identical 16 characters/bytes on all nodes, not more not less!
#define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!
#define ACK_TIME       30  // # of ms to wait for an ack packet


and here is what I have loaded onto the Garage Mote Moteino:

#define GATEWAYID   1
#define NODEID      2
#define NETWORKID   100
//#define FREQUENCY     RF69_433MHZ
//#define FREQUENCY     RF69_868MHZ
#define FREQUENCY       RF69_915MHZ //Match this with the version of your Moteino! (others: RF69_433MHZ, RF69_868MHZ)
#define ENCRYPTKEY      "sampleEncryptKey" //has to be same 16 characters/bytes on all nodes, not more not less!
#define IS_RFM69HW_HCW  //uncomment only for RFM69HW/HCW! Leave out if you have RFM69W/CW!

/

HeneryH

  • Full Member
  • ***
  • Posts: 229
Re: Pi/Base Moteino problem
« Reply #22 on: December 13, 2018, 08:55:17 PM »
Did you try the serial port monitor like I suggested to see the debug statements?

griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #23 on: December 13, 2018, 10:20:47 PM »
yes i've been trying it.

This is what I have been getting when I start the monitor:


Transmitting at 915 Mhz...
SPI Flash Init OK!


and I get nothing when I position the magnets in front of the HED's.  so somehow there is no communication between them.

HeneryH

  • Full Member
  • ***
  • Posts: 229
Re: Pi/Base Moteino problem
« Reply #24 on: December 13, 2018, 11:22:04 PM »
I'll ask only because I made this mistake recently...  are the transceivers the same on the boards?  Look at them and make sure they look the same.  I had one HCW and another CW and didn't realize.


griiker

  • NewMember
  • *
  • Posts: 15
Re: Pi/Base Moteino problem
« Reply #25 on: December 16, 2018, 06:52:20 PM »
They are the same boards, i checked.  The LED on the board connecting to the raspbery pi does not remain lit when plugged into the raspberry Pi,  it comes on flickers a bit then goes out after a few seconds, is this normal?  it leads me to believe that the board itself has a problem.

HeneryH

  • Full Member
  • ***
  • Posts: 229
Re: Pi/Base Moteino problem
« Reply #26 on: December 16, 2018, 07:04:59 PM »
They are the same boards, i checked.  The LED on the board connecting to the raspbery pi does not remain lit when plugged into the raspberry Pi,  it comes on flickers a bit then goes out after a few seconds, is this normal?  it leads me to believe that the board itself has a problem.
You have to read the sketch code, particularly the setup() and loop() function to see what is expected. 

Often at the bottom of the setup() function there are calls to blink() a few times to flash the LED.

There is a #define for enabling the serial debug output.  Make sure debug output is enabled to get enhanced debug info out the serial port.

Report back here with what you get from the serial monitor.
« Last Edit: December 16, 2018, 07:07:00 PM by HeneryH »