code in excel multi-relay projection

Hi All,

A month ago I was clueless about arduino and I began a process of learning about it to create a multi analog slide projector slideshow. I’ve got the hardware all setup, I played around a little bit with the arduino software for writing the code - It’s confusing to me but I can do some things.

I’m at a crossroads where I need guidance on how to create a basic template for writing this pre-programmed 9 projector slideshow. My first and only thread in the projects forum led one member to suggest writing the code in Excel as to make the code more visual, using a simple timeline and projector spreadsheet with 1’s and 0’s as my indicators of when to “pulse” indicate an advance in slides for each individual projector. I have attached that screenshot below.

I also have attached a basic, 4 relay code that I borrowed (thanks to terry@yourduino.com) to experiment with in arduino.

How do I combine the excel idea with the arduino code that I have (if it makes sense). Or if it seems better to start over with excel entirely, does anybody have an idea of the script basics I should/could use? I’m lost about how to write the code before the basic time/advance template that is illustrated below. Does anybody have any guidance or even code to share with me that would get me started on the foundation of this code? I know there’s a step in there where I need to convert the excel doc into a CSV format and indicate somewhere in that code to auto run on the SD card shield.

My setup: Arduino Uno, SD card reader shield, 16 channel relay board, projector remote’s wired into the relay board for advance function only, the projectors themselves, I’m running on a Mac. Thanks in advance for your wisdom!

Are you looking for a picture of an answer? If no, DO NOT POST PICTURES OF TEXT AND CODE. They are worthless.

Excel can not write to the serial port, so developing in Excel does not make sense. Excel can not invoke the compiler, so developing in Excel does not make sense.

What Excel CAN do is allow you to develop data that you copy and paste into the Arduino IDE when you are writing code.

PaulS:
Excel can not write to the serial port

Are you positive? You can get to the serial ports from vba. I'm not 100% on how. I don't know a lot of vba. But I do know that it is possible to get to the serial ports from excel.

Please post your code as text in code tags (the </> symbol).

There are 2 ways that you can do this.

The first is to use Excel as the controlling device and the Arduino as a slave, with a permanent comms link between the two. You would need to write some VBA (as suggested by Delta_G) to read your spreadsheet ‘pattern’ and interpret it into something for the Arduino, send it across the serial link, and then use that data to do whatever you need at that end (activate relays, I presume). This requires the PC and Arduino to be connected all the time for things to work, and may not be a good solution if that is not the intention.

The other way is to use Excel to easily generate the data and then copy/paste a CSV string into a data array in the Arduino code (or an SD card). The code then scans this data and activates the relays as required. This allows the Arduino to run standalone.

I expect that the data for the patterns will be tuples of (relay ID, time delay), repeated a number of times.

In either case you will need to get familiar with two concepts that seem to be missing in the code you have supplied:

  1. Learn to use arrays to make your code efficient and compact. You can use them to represent the data and also the relays pin numbers.
  2. Learn to code using the techniques demonstrated in the BlinkWithoutDelay example code. It will be the only way that you can run 4 relays independently.

Additionally, learning to use structures will help you organize the data in an efficient and intuitive manner. if the data is stored with the code.

An example of this type of code is in my MultiBlink sketch in my code repository, links below in my signature block. Definitely not beginner code as it is made to be general, but it is the type of techniques that you are aiming for.

Are you positive? You can get to the serial ports from vba. I'm not 100% on how. I don't know a lot of vba. But I do know that it is possible to get to the serial ports from excel.

VBA != Excel.

PaulS:
VBA != Excel.

I guess technically Excel is a program and VBA is the language you program it with. So yeah they're not equal. But you can definitely write VBA from Excel that will allow you to do what the OP wants.

But you can definitely write VBA from Excel that will allow you to do what the OP wants.

I think OP will have a hard time using VBA to write Arduino code, compile it, and upload it to the Arduino.

Yes, VBA can be used to access data in an Excel spreadsheet, and send that data to the serial port that the Arduino is listening to, but that seems quite different from what OP asked for.

Paul, go read the thread again. Nobody is trying to put VBA code on Arduino. I was simply trying to point out that you can send data from excel over the serial port using VBA macros in excel.