Hello Arduino lovers,
I've done a bunch of Microchip programming in times gone by - but this is my first Arduino project.
I really love the Serial Monitor!!
I've been talking to a motorized device via serial from my PC
The Serial Device requires TTL level signals
I wrote a Windows Powershell script to control the device using keyboard buttons as prompts for various commands to the device.
There is only one instance in which I need to receive data from the device at its boot-up. At power-up the device sends a specific number string which indicates it is functioning normally.
I would now like to try doing this with the Arduino NANO.
But I'd like to keep the NANO connected to the Arduino Serial monitor so that when the device sends its initialization string - the NANO can send that to the Serial Monitor.
I've got the NANO's PORTD pints D2-D7 connected to a JoyStick switch (5 possible user selections).
So these pins are dedicated to that task.
Also the NANO has D0-D1 connected to the onboard USB chip - so those pins are dedicated also.
I'm reading the JoyStick - using the PIND function and masking out D0-D1
User selection from the JoyStick then resolves to 5 possible binary values which I process with a case-statement.
What would you suggest my approach be for establishing the serial com to the motorized device?
I could for example try to use two of the PORTB pins which on the NANO board are used for ICSP
Those pins are otherwise not being used.
Hi Steve,
If I understand what your saying - I would worry about a couple of possible problems with that approach.
Firstly, I'd want to establish isolation between the two serial port solutions.
So a different port dedicated for serial to the motorized device would do that.
Secondly the USB signals on the NANO's USB output would have to be converted to TTL level rs232 to talk with the motorized device. I can do that - but it would require extra hardware. And I'm still a little worried about two separate serial signals de-modulating each other being connected together to the NANO's FT232RL USB chip.
Wouldn't it seem to be wisdom to use the NANO PORTB or PORTC since they are otherwise not used - rather than PORTD which is used?
Ok, I've decided to use D11 and D12 for the second Serial - and use the SoftwareSerial Library utilities.
I've temporarily tested this a little by sending some data to an LCD display at the same time I'm sending data to the Serial monitor.
So I think I'll move forward with that as my tentative solution.
got_arduino:
So I think I'll move forward with that as my tentative solution.
If you find this problematic, (Software Serial has it's limitations), other Arduino types have more hardware serial ports. For example Arduino Pro Micro (do not confuse with Pro Mini). Switching to Pro Micro will require some changes to your sketch. Atmega port/pin numbers will be different to Nano, so I would suggest sticking to digitalRead()/digitalWrite() and Arduino port numbers, rather than reading ports directly and masking bits. That's not the "Arduino way", because it's not portable, and in most cases uneccessary.