Newbie here. But I’ve done a lot of Arduino basic programming. I purchased a number of Spark Cores, hoping that my existing Arduino code would work. I was frustrated to learn that dropping in the Spark in place of my Arduino Nano’s was a seemingly insurmountable task without major reprogramming. The biggest problem was that my existing project utilizes 3 SoftwareSerial devices (RTC, openLog, and a serial LCD). I’m not sure how to make all of these work with the Spark.
Questions:
1 - Is there a SoftwareSerial equivalent yet for the Spark Core? Anyone working on?
2 - Is there an easy way to pull RTC information from the network via the Spark Core, and avoid the RTC module?
3 - Same for openLog; is there an easy way to log data to a file on the network instead of using a microSD?
@dschmid4, I understand the frustration for someone jumping from one hardware platform to another. The Core has several features that the Nano does not and though you may have to modify your code, the extra features gained will be worth it. So let’s look at your requirements:
RTC - The Core has a built-in RTC which is synchronized with the cloud so you don’t need an external RTC!
Serial ports - Presently the Core has the USB serial and a second port Serial1. Soon, support for a third serial port (Serial2) will be released so you will be able to handle both your OpenLog and serial display. Does your serial display also support I2C or SPI communications?
If you use a simple microSD breakout, we have a complete library for that!
As for logging to the cloud, there are a number of ways to do this. Look under the Project Share category for great examples
I don’t know of one off the top of my head, but there may be one floating around out there. You can get an extra serial port using Serial1 instead of Serial. The docs for that are here.
Yes! That part is pretty simple. It doesn’t support daylight savings time at the moment, but that is being worked on. The documentation for the time library is here.
There’s not a built-in way to write to a log file across the network. You can monitor Spark.publish() or poll using Spark.variable() or even use TCPClient to make a web request that can log the data to a file.
For #3 in particular, @bko has written a bunch of tutorials to help you out with that. Take a poke at some of the documentation links above and let us know the next step we can help with!
Thanks guys.
1 - Serial ports: I will look into Serial1. Do you have timing for Serial2? My current 16x4 serial LCD does not support I2C, but if you have a good recommendation I’ll get some. I haven’t used I2C before, but from what your saying it seems this may be my best short term solution to talk with both my logger and my LCD.
2 - RTC: great news. I’ll ditch my RTC and look into the library you sent.
3 - microSD: I’m using the SparkFun OpenLog (DEV-09530) via SoftwareSerial. If I use Serial1 for this, are there libraries available or would I need to start from scratch? With the libraries currently available for a simple microSD breakout, would it be less effort to switch to one of these?
@dschmid4, a lot of 16x4 LCD panels come with I2C “backpacks” like this one on ebay. I prefer the smarter displays from Digole like this 16x4 one. They support serial, I2C and SPI.
There are presently no libraries for OpenLog. I used an OpenLog on a Teensy2 project where I could not use a microSD card due to SPI bus conflicts. When I got my Spark, I ported the code and used a microSD with the library we have and it was a lot easier to use since I had more control of when the files opened, etc. If you want to do that, I can share the portions of the code that setup and do the logging.