Strange characters are appearing when I communicate between Intel Edison and NodeJS via serial port

I have connected an FTDI device to my computer, with the FTDI then connected to an Intel Edison Arduino breakout board using the 0RX and 1TX pins.

Here is the serial pin hookup:
Edison TX ------> FTDI RX
Edison RX ------> FTDI TX

To manage the GPIO on the Intel Edison, I followed the instructions provided in the top answer of this post:

To check my GPIO configurations, I ran the command:
cat /sys/kernel/debug/gpio

This output was displayed:

Nodejs code:

var SerialPort = require("serialport").SerialPort;  
var port = "/dev/ttyMFD1";  
var serialPort = new SerialPort(port, {  
  baudrate: 9600  
}, false);  

console.log("Open port: "+ port);  
serialPort.open(function (error) {  
  if (error) {  
    console.log('Failed to open: '+error);  
  } else {  
    console.log('open');  
    serialPort.on('data', function(data) {  
      console.log('data received: ' + data);  
    });  

    var counter = 90;  
    setInterval(function () {  
      serialPort.write(String(counter)+ "\r\n", function(err) {  
        if(err) {  
          console.log('err ' + err);  
        }else{  
          console.log('Writing data ');  
        }  
      });  
      counter++;  
      if(counter>100)  
        counter =90;  
    }, 1000);  
  }  
});

Upon running:
node uart.js

I noticed strange characters appearing even when no data was being sent to the Intel Edison.
Strange characters shown were:

To investigate if the nodejs script was causing the issue, I tried: cat /dev/ttyMFD1
which resulted in showing the same odd characters without any outgoing data being sent to the Intel Edison.

I am puzzled by the appearance of these random characters without any active communication. Unsure if it's a GPIO configuration error or interference causing noise... What steps should I take to address/troubleshoot this situation?

In an attempt to further troubleshoot, I added the following code snippet within the serialPort on function:

var s = JSON.stringify(data);
console.log ("data: " + s);

The output from this code was:
[255,255,255,255]

UPDATE
It appears that the issue lies with the setInterval function. After removing it and implementing a for-loop test, I successfully sent characters over 10 rounds without encountering the garbled characters.

Answer №1

Improve your coding experience by utilizing PIN0/PIN1 for UART functionality (TX/RX) with MRAA without the need to configure it from the command line.

 const mraa = require('mraa');
 const uartDevice = new mraa.Uart(0);

Answer №2

The odd symbols appeared because of a simple error I made. I had neglected to connect the ground (GND) from the FTDI board to the Intel Edison's GND. As soon as I rectified this by connecting the two GNDs, the strange characters disappeared.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

When using TypeORM's findOneBy method, if the search result

In order for the entity to have both identifiers, I require it to possess the Id and the _id export class ScriptSequencesExecutionEntity { @PrimaryGeneratedColumn({ name: 'id' }) _id!: string; @ObjectIdColumn() id: number; @AutoMap() ...

Twilio Fax Reception: Blank Body Detected

I have embarked on my journey with Twilio's Programmable Fax API and successfully followed their getting started guide. However, upon receiving the fax, I encounter an issue where the request body appears as an empty object when logged to the console. ...

Is there a way to inform TypeScript that the process is defined rather than undefined?

When I execute the code line below: internalWhiteList = process.env.INTERNAL_IP_WHITELIST.split( ',' ) An error pops up indicating, Object is possibly undefined. The env variables are injected into process.env through the utilization of the mod ...

Struggling to grasp the concept of an Express server in Node.js

As I was following some online tutorials on setting up a Node server using Express 4, I wanted to simplify my question for better understanding. The main app.js file contains the following code (excluding other middleware lines) var express = require(&ap ...

What methods can I use to conceal a Script within a particular subDomain in Next.js?

on the main website page, there is a chat window script that needs to be hidden on any subdomain, for example: domain.com >> allow the Script ,,,, *.domain.com >> disallow the Script *.domain.com/* >> disallow the Script import { Html ...

Problem encountered during bower installation: the user ID must be a non-negative integer

Just wanted to say thank you in advance I'm having an issue with installing bower, and it's showing me this error message: MYNAME-MacBook-Pro:~ MYNAME$ sudo chown -R $(MYNAME) ~/.npm -bash: MYNAME: command not found usage: chown [-fhv] [-R [-H ...

Executing Selenium tests: utilizing the webdriver.wait function to repeatedly call a promise

Currently, I am using Selenium ChromeDriver, Node.js, and Mocha for testing purposes... I am facing a dilemma at the moment: The driver.wait function seamlessly integrates with until. I have a promise, which we'll refer to as promiseA. This pro ...

The deployment of a Reactjs application on Heroku was unsuccessful and crashed unexpectedly

I am currently attempting to deploy my React app on Heroku. The log file shows that the build was successful, but when I try to run it in the browser, I receive an error message after seeing "Starting the development server...". Process exited with status ...

Why am I getting an 'undefined' error for my 'req'? It's showing 'TypeError: Cannot read property 'headers' of undefined'

Currently, I'm in the process of integrating authentication middleware into my routes within an Express Router. However, when the router reaches the middleware and attempts to access req.headers["authorization"], I encounter the following e ...

Having trouble running a React application from GitHub on VS Code

Sorry for the beginner question. I recently downloaded a React application from GitHub. However, when I attempt to run it locally on VS Code, I encounter some dependency errors. Here are the dependencies listed in the JSON file: "dependencies": { ...

Steps for launching Angular 5 application using Node.js server

I have developed an Angular 5 application that retrieves data from a node.js server. I successfully deployed the application to my web server hosted by FastComet, which supports node.js, but unfortunately, the server does not seem to be functioning properl ...

Passport Custom Redirects: Take Control of Your Navigation Path

Looking to set up basic authentication for my first public-facing Node app, utilizing two Passport strategies: one for Facebook and one for Twitter. Not considering an email/password system at the moment until I fully comprehend the security implications. ...

"Accessing your account only requires a simple two-click login process

Why do I need to click the log in button twice for data validation on my forum website? While designing a forum website, I noticed that users have to click the log-in button twice before the system validates and processes the input data. Below is the code ...

Following the initial query that was executed successfully on the Heroku Postgres table, all subsequent queries have been

This web application is built using Node.js and Express, and it's deployed on Heroku. I have incorporated the Heroku Postgres add-on (client refers to my connection with the Heroku Postgres database). I followed this reference guide while structuring ...

What are the best ways to maximize a web worker's ability to handle multiple tasks at once

I'm currently working on implementing a Web-Worker to handle its state while also managing multiple asynchronous requests. worker.ts file let a =0; //state of the worker let worker=self as unknown as Worker; worker.onmessage =(e)=>{ console ...

Create a Mongoose model that includes a field containing an array of ObjectID's

I am encountering an issue with my object named company, which contains keys for name(String) and locations(Array). Within the locations key, I want to include a user-generated key called name, as well as a second key generated using ObjectID. However, I a ...

What is the process for integrating Express middleware after implementing Apollo-Server v2 middleware?

I've encountered a unique issue while working with Express and Apollo Server. Despite searching online for solutions, it seems like this requirement is specific to me. My dilemma arises when I attempt to integrate an Express middleware after using th ...

Tips for sending two values with .render() to Handlebars

My current task involves passing multiple values into res.render for my handlebars template. The condition is met, but the content does not display as expected. Specifically, I am attempting to customize the navigation bar and show a user's snippets ...

Tips for resolving this unhandled error in React TypeScript

After creating a program in React TypeScript, I encountered an uncaught error. Despite running and debugging tests and conducting extensive research on Google, I have been unable to resolve this issue on my own. Therefore, I am reaching out for assistance ...

The inheritance caused this scope to be lost

Here is an illustration of code with two files and "classes". In the CRUD class, there is a problem with this.modelName when setting routes as it changes the context. The question arises on how to maintain the same scope within the CRUD where modelName is ...