Using an Arduino UN...
 
Notifications
Clear all

Using an Arduino UNO rather than the HAT

10 Posts
3 Users
0 Reactions
1,645 Views
marcuso
Posts: 11
Topic starter
(@marcuso)
Eminent Member
Joined: 3 years ago

Hi, 

I cant find any Fab Scan Hat (pi or uno), so I would like to use an Arduino UNO connected to the Pi.

If using an UNO rather than the HAT, do I need to change the UNO bootloader, or just upload the firmware ? 

I've downloaded the firmware on to the Uno from this github repo

mariolukas/FabScanPi-Firmware: Firmware of FabScanPi 3D Laser Scanner (github.com)

I can send commands to the Uno via UART with the serial monitor from the Arduino IDE.

I've also got the Pi side working, after connecting the Uno to the Pi via USB, the server starts up but I am getting the bootloader message in the FabScan Server log file

INFO - fabscan.server.FSScanServer: FabScanPi-Server 0.9.4
DEBUG - fabscan.scanner.interfaces: Scanner Type is: laserscanner
DEBUG - fabscan.scanner.laserscanner.driver.FSSerial: Port in Config found
DEBUG - fabscan.scanner.laserscanner.driver.FSSerial: Latest available firmware version is: v.20200624
INFO - fabscan.lib.util.FSUtil: b'avrdude-original: Using autoreset DTR on GPIO Pin 7'
ERROR - fabscan.scanner.laserscanner.driver.FSSerial: Communication error on port /dev/ttyAMA0 try other flashing baudrate than 115200. Maybe corrupted bootloader.

From the browser I get the error (shortened message here for brevity)

The FabScanPi server is currently not running

So any ideas on why the FabScan server has comms error to the Arduino firmware ? BTW I do not have any hardware/peripherals etc connected to the Arduino UNO yet - I presume there is no feedback from the UNO to the FabScan via serial in terms of peripheral state ?

Thanks

Marcus

Reply
9 Replies
marcuso
Posts: 11
Topic starter
(@marcuso)
Eminent Member
Joined: 3 years ago

Got it working - used latest Pi image, and renamed the dev port in the config file.

Reply
uro
 uro
(@uro)
Joined: 2 years ago

Active Member
Posts: 5

@marcuso 

Hi,

I try the same configuration (Pi with UNO) using USB. What do You mean

with rename the dev port?

Thanks for Your help.

Uwe

Reply
Wolf2021
Posts: 31
(@wolf2021)
Eminent Member
Joined: 3 years ago

hello,
I have realised my project with an original Arduino UNO (no clone,please because of speed problems with usb)
and an attachable ZUM Scan Shield for Cliclop.
This HAT has all the necessary connections and a slot for the stepper motor driver. You can buy it at ebay.
I use the TMC2209 from BIGTREETECH as stepper motor driver.

I downloaded the Arduino SW from Mario on GITHUB and modified it (pin-addresses on Cyclop).
Motherboard = CYCLOP, baud rate = 57600.

modification arduino software

version.h
#define BUILD_VERSION "v.20210318"

configuration.h

#ifndef MOTHERBOARD
#define MOTHERBOARD BOARD_CYCLOP
#endif

#ifndef BAUDRATE
#define BAUDRATE 57600
#endif

check pin assignment

pins_CYCLOP.h
#define RIGHT_LASER_PIN 2
#define LEFT_LASER_PIN 3
#define RIGHT_LASER_LED_PIN 4
#define LEFT_LASER_LED_PIN 5
#define MICROSTEP A5

/*
* Turntable Stepper
*/
#define ENABLE_PIN_0 9
#define STEP_PIN_0 12
#define DIR_PIN_0 13

/**
* WS2812 LED
*/
#define LIGHT_PIN A0

To see the work of the laser outside I mounted 2 additional LED. UNO pins 4 + 5

LaserDriver.ccp

void initialize_laser_driver(){
pinMode(RIGHT_LASER_PIN, OUTPUT);
pinMode(LEFT_LASER_PIN, OUTPUT);
pinMode(LIGHT_PIN, OUTPUT);
pinMode(RIGHT_LASER_LED_PIN, OUTPUT);
pinMode(LEFT_LASER_LED_PIN, OUTPUT);
digitalWrite(LIGHT_PIN, LOW); //turn light off
digitalWrite(RIGHT_LASER_PIN, LOW); //turn right laser off
digitalWrite(LEFT_LASER_PIN, LOW); //turn left laser off
digitalWrite(RIGHT_LASER_LED_PIN, LOW); //turn right laser LED off
digitalWrite(LEFT_LASER_LED_PIN, LOW); //turn left laser LED off
}

void left_laser_on(){
digitalWrite(LEFT_LASER_PIN, HIGH);
digitalWrite(LEFT_LASER_LED_PIN, HIGH);
laser_is_active = true;
}

void left_laser_off(){
digitalWrite(LEFT_LASER_PIN, LOW);
digitalWrite(LEFT_LASER_LED_PIN, LOW);
laser_is_active = false;
}

void right_laser_on(){
digitalWrite(RIGHT_LASER_PIN, HIGH);
digitalWrite(RIGHT_LASER_LED_PIN, HIGH);
laser_is_active = true;
}

void right_laser_off(){
digitalWrite(RIGHT_LASER_PIN, LOW);
digitalWrite(RIGHT_LASER_LED_PIN, LOW);
laser_is_active = false;
}

compile and upload

I use FabScanPi-Server 0.10.0

important and necessary changes in fabscan.setup on Raspberry pi

sudo nano /etc/fabscanpi/default.config.json

"connector": {
"type": "serial",
"firmware": "ciclop",
"baudrate": 57600,
"autoflash": "False",
"flash_baudrate": 115200,
"port": "/dev/ttyACM0"

autoflash must be set to False, otherwise arduino software will be overwritten.

USB connection UNO <---> Raspberry Pi USB1

I hope i could help, it works perfectly for me

Reply
Wolf2021
Posts: 31
(@wolf2021)
Eminent Member
Joined: 3 years ago

I forgot one very important thing when using UNO and ZUM.

The USB connector of the UNO is made of metal and must be insulated with tape,

 

L3190049

otherwise there will be a short circuit in the power supply of the ZUM. (see picture)

L3190047

Kind regards

Reply
marcuso
(@marcuso)
Joined: 3 years ago

Eminent Member
Posts: 11

@wolf2021 Thanks Wolf, I am trying to conenct the Arduino without a hat to the motor driver and motor, if I cant figure it out (whicch I havent given up yet), I will use the Hat as you suggested, thanks again.

Reply
Wolf2021
(@wolf2021)
Joined: 3 years ago

Eminent Member
Posts: 31

@marcuso 

hi, in my test phase I used a motor driver with success,

but the ZUM HAT has additional FET drivers for the LASER

and a direct connection to the UNO. That's the benefit.

best regards

Reply
marcuso
(@marcuso)
Joined: 3 years ago

Eminent Member
Posts: 11

@wolf2021 Do you remember the pin connections for the motor driver ?

Reply
Wolf2021
(@wolf2021)
Joined: 3 years ago

Eminent Member
Posts: 31

@marcuso 

Hi, if you want to use the Horrus FW, you will find the assignment in the software at https://github.com/bqlabs/horus-fw/blob/develop/cpu_map.h.

Kind regards

Reply
Wolf2021
(@wolf2021)
Joined: 3 years ago

Eminent Member
Posts: 31

If you want to use Mario's SW, the assignment can be found in the Arduino SW in the file for cliclop.

Kind regards

Reply
Share: