Sunday, April 11, 2021

NANO Arduino CNC shield

 Needed to remove Mot_VOT_Sel (green jumper next power connector) before programming from Arduino IDE as supposed the external power prevent the reseting of the NANO

NOTE that most of the online pictures of the A4988 modules are inserted in the WRONG orientation.  Following picture is my working one.


CONTROL     Dir    Step
       X             pin2    pin5
       Y             pin3    pin6
       Z             pin4    pin7


Used the following to test the board with the modules:

/*     Simple Stepper Motor Control Exaple Code
 *      
 *  by Dejan Nedelkovski, www.HowToMechatronics.com
 *  
 */

// defines pins numbers for X
const int stepPin = 5; 
const int dirPin = 2; 
 
void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT);
}
void loop() {
  digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction
  // Makes 200 pulses for making one full cycle rotation
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH); 
// increase the delay to 1 msec as the original 0.5 msec wouldn't work well
    delayMicroseconds(1000); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(1000); 
  }
  delay(1000); // One second delay
  
  digitalWrite(dirPin,LOW); //Changes the rotations direction
  // Makes 400 pulses for making two full cycle rotation
  for(int x = 0; x < 400; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(1000);
  }
  delay(1000);
}




Saturday, March 6, 2021

IOT using mkr 1010

Environment

Acer Aspire 4741G

Ubuntu 20.04.2 LTS

Arduino IDE 1.8.13

WifiNINA firmware ver. 1.3 (after installation of library)

Lesson

LEARN - Building Internet of Things Projects with Arduino IOT Cloud by Lee Assam

Setup

sudo snap install arduino

Board manager - install Arduino SAMD boards (32-bits ARM Cortex-M0+) by Arduino version 1.8.11

Library manager - install WifiNINA

in ubuntu

sudo usermod -a -G dialout $USER & reboot





Friday, December 18, 2020

Classic bluetooth connection on Arduino

//  use the following sample to connect to the mobile Serial bluetooth terminal app by Kai Morich to test // modules are working or not

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 4); // RX, TX configured on Arduino to TX, RX of bluetooth module

void setup() {

  // Open serial communications and wait for port to open:

  Serial.begin(9600);  // so far, it seems 9600 is the working baudrate

  while (!Serial) {

    ; // wait for serial port to connect. Needed for native USB port only

  }

  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port

  mySerial.begin(9600);

  mySerial.println("Hello, world?");

}

void loop() { // run over and over

  if (mySerial.available()) {

    Serial.write(mySerial.read());

  }

  if (Serial.available()) {

    mySerial.write(Serial.read());

  }

}