Where do I start / How to avoid common errors

Hi, sorry for the very basic question but I'm a long time programmer with absolutely no experience in electronics. Consider this question an high level question, not a detailed one (nor I do need detailed answers).

Premise:

I must create a project and I have a simple switch (on/off), a led, three sensors and an SD shield.

How should it work:

when I click the button, the led turns on (off if I click the button again), I continuously get data from the three sensors and any data is written to a file in a SD until I turn off button (and led).

The main questions are: can I connect all these sensors? Is there any limit? What should I care about before purchasing any sensor? Isn't there any relation between the power needed by the sensor and my batteries? Moreover, are batteries safer than power suppies? Can you point me to some resource?

As you can see I'm very confused.

It doesn't help to find shields like this one: https://www.seeedstudio.com/Base-Shield-V2-p-1378.html (I don't understand if they are required, they are simply useful or should I avoid them).

The project is a mid school project (nothing professional, but it should at least work), I'm currently very ignorant but I'm a fast learner and I have two months of time to improve my non-existent electronics skills. :-)

can I connect all these sensors?

Maybe. Depends on the sensors. If a given sensor needs 48 wires, probably not.

Is there any limit?

How many pins do you have? How many do you need?

What should I care about before purchasing any sensor?

Does it measure what you want to measure?

Isn't there any relation between the power needed by the sensor and my batteries?

Of course there is.

Moreover, are batteries safer than power suppies?

Yes. All that power running through the wires in your house is going to kill you. I know it will; I read it on the internet.

Can you point me to some resource?

For?

I would just say there are soem good Arduino project books in the Evil Genius series and those by Simon Monk.

Well worth a read

Is the ask that you build a data logger with three channels of data or are there particular data elements that you must collect?

It's not entirely clear from your post whether you actually have the equipment you need yet.

That seeedstudio shield is not necessary - you can put this together with an arduino and a breadboard (plus interconnect wires)

To get any solid advice though, you need to provide more details.

Maybe have a look at Planning and Implementing a Program although it was not written for a complete beginner.

If you are new to Arduinos and programming don't try to plan your whole project up front.

  • Download the IDE and study some of the example programs that come with it.
  • Get an Uno and try out some of the programs, and try modifying them and writing your own simple programs.
  • Get one of the sensors you need and write a short program to learn how to use it.
  • etc etc

You will almost certainly find that your concept of your project and what you actually require will vary as you gain experience.

...R

Hi, sorry for the very basic question but I’m a long time programmer with absolutely no experience in electronics.

Hopefully, you’re going to get some guidance from your instructor (and your textbook). Do you have the prerequisites for this class? Maybe some of your classmates have some electronics experience?

I continuously get data from the three sensors and any data is written to a file in a SD until I turn off button (and led).

You’ll need an add-on board (or shield) for the SD card.

The main questions are: can I connect all these sensors? Is there any limit? What should I care about before purchasing any sensor?

A sensor can be almost anything. The simplest sensors will be analog or digital with one connection (plus a common ground connection). Common sensors would be temperature or light sensors, or infra-red motion sensors, or you can get a sound sensor board, etc.

The digital pins are 0 (logic 0 = low) or 5V (logic 1 = high). The analog pins are 0-5V. The digital pins are “normally” binary logic, but they can be configured for basic serial or I2C if you need to communicate more data (or if your sensor uses something like that). So, you’ll want to use sensors that work with 5V or otherwise can “communicate” with the Arduino.

The Arduino has 14 digital input/output pins and 6 analog input pins. You’ll need an output pin for the LED and a few pins for the SD card. The other pins can be used as inputs from your switch and sensors.

Isn’t there any relation between the power needed by the sensor and my batteries? Moreover, are batteries safer than power suppies?

A “wall wart” power supply is safe (as long as it’s from a reputable manufacturer/supplier :wink: ). You can also power the Arduino from USB as long as all of our electronics works with 5V and as long as you’re not trying to power motors or LED strips, or anything that takes lots of power. i.e. You can plug your Arduino into the USB port and run [u]Blink Example[/u], and the only additional hardware you need is a USB cable.

It doesn’t help to find shields like this one: https://www.seeedstudio.com/Base-Shield-V2-p-1378.html (I don’t understand if they are required, they are simply useful or should I avoid them).

A “shield” is a plug-in add-on board for the Arduino. There are all kinds of shields. That particular one is a “breakout board” that simply allows you to plug-in some connectors. So for example, your sensors would need mating connectors. It’s really not necessary, but it is a nice way to make connections to your Arduino.

There are “prototyping” shields that you can solder your own components/wires onto if you want to build your own circuit.

It’s also common to built your own custom circuit on a [u]breadboard[/u]. Breadboards are designed for temporary experimentation or prototyping but I’ve used them on permanent projects several time. The big downside is that they are bulky.

PaulS: For?

Deepen my knowledge about anything you suggest :-) (btw, thanks)

PaulHammy: I would just say there are soem good Arduino project books in the Evil Genius series and those by Simon Monk.

Well worth a read

Ok, thank you

wildbill: Is the ask that you build a data logger with three channels of data or are there particular data elements that you must collect?

It's not entirely clear from your post whether you actually have the equipment you need yet.

I must collect some data coming from the three sensors and I must format them this way:

currentTime : dataFromSensor1 | dataFromSensor2 | dataFromSensor3 + "\n\r"

The data should be possibly be retrieved this way (pseudocode):

  1. var d1 = getDataFromSensor1()
  2. var d2 = getDataFromSensor2()
  3. var d3 = getDataFromSensor3()
  4. writeData(d1,d2,d3);

I don't know if I'm replying correctly your first question.

//

No, I haven't all the sensors, I only know which ones I do eventually need.

Robin2: Maybe have a look at Planning and Implementing a Program although it was not written for a complete beginner.

If you are new to Arduinos and programming don't try to plan your whole project up front.

  • Download the IDE and study some of the example programs that come with it.
  • Get an Uno and try out some of the programs, and try modifying them and writing your own simple programs.
  • Get one of the sensors you need and write a short program to learn how to use it.
  • etc etc

You will almost certainly find that your concept of your project and what you actually require will vary as you gain experience.

...R

As I said, I'm totally new to electronics (and of course Arduino) but I have been programming about 16 years now (mainly ECMAScript, PHP, C#, Objective-C, Swift).

I haven't any problem with the programming part, I've seen many Arduino programming examples and they are all really basic. Where I'm really disoriented is the hardware part.

Thanks for any advice.

DVDdoug:
Hopefully, you’re going to get some guidance from your instructor (and your textbook). Do you have the prerequisites for this class? Maybe some of your classmates have some electronics experience?

There’s a little misunderstanding here, my fault for sure. I’m one of two teachers: I’m the software teacher and then there’s an electronics teacher. We should start classes in june but we can’t collaborate until then (we can’t even talk, at the moment I don’t even know who is this person). What I do know is what we must build: since I haven’t Arduino experience, I’m trying to build the prototype myself.

DVDdoug:
You’ll need an add-on board (or shield) for the SD card.

I said it in my first post :slight_smile: At the moment one thing that confuses me very much is how these shields are connectable (cables, soldering, breadboards, etc.)

DVDdoug:
A sensor can be almost anything. The simplest sensors will be analog or digital with one connection (plus a common ground connection). Common sensors would be temperature or light sensors, or infra-red motion sensors, or you can get a sound sensor board, etc.

This is what I would use (any comment about 1,2 and 3 is welcome and appreciated):

  1. https://www.amazon.com/Dexter-Industries-Arduino-GPS-Shield/dp/B006LR97BO
  2. something similar to this: https://www.seeedstudio.com/Grove-Gas-SensorMQ3-p-1418.html?cPath=25_127 (two different sensors)
  3. MicroSD card breakout board+ : ID 254 : $7.50 : Adafruit Industries, Unique & fun DIY electronics and kits
  4. a led
  5. a button

DVDdoug:
The digital pins are 0 (logic 0 = low) or 5V (logic 1 = high). The analog pins are 0-5V. The digital pins are “normally” binary logic, but they can be configured for basic serial or I2C if you need to communicate more data (or if your sensor uses something like that). So, you’ll want to use sensors that work with 5V or otherwise can “communicate” with the Arduino.

The Arduino has 14 digital input/output pins and 6 analog input pins. You’ll need an output pin for the LED and a few pins for the SD card. The other pins can be used as inputs from your switch and sensors.
A “wall wart” power supply is safe (as long as it’s from a reputable manufacturer/supplier :wink: ). You can also power the Arduino from USB as long as all of our electronics works with 5V and as long as you’re not trying to power motors or LED strips, or anything that takes lots of power. i.e. You can plug your Arduino into the USB port and run [u]Blink Example[/u], and the only additional hardware you need is a USB cable.
A “shield” is a plug-in add-on board for the Arduino. There are all kinds of shields. That particular one is a “breakout board” that simply allows you to plug-in some connectors. So for example, your sensors would need mating connectors. It’s really not necessary, but it is a nice way to make connections to your Arduino.

There are “prototyping” shields that you can solder your own components/wires onto if you want to build your own circuit.

It’s also common to built your own custom circuit on a [u]breadboard[/u]. Breadboards are designed for temporary experimentation or prototyping but I’ve used them on permanent projects several time. The big downside is that they are bulky.

This is the part I really need to study

perkpet: Where I'm really disoriented is the hardware part.

Then IMHO it is important to work on each hardware item independently until you are familiar with it.

When you write software, such as a diary or a photo album, you have complete control of the system and can easily write software tests. Interfacing with hardware is a little different because you no longer have complete control. For example you can't make a temperature sensor report a temperature of 20degrees.

Adapting to the very small memory of an Arduino also seems to be a challenge for some PC programmers.

...R

Robin2: Then IMHO it is important to work on each hardware item independently until you are familiar with it.

When you write software, such as a diary or a photo album, you have complete control of the system and can easily write software tests. Interfacing with hardware is a little different because you no longer have complete control. For example you can't make a temperature sensor report a temperature of 20degrees.

Adapting to the very small memory of an Arduino also seems to be a challenge for some PC programmers.

...R

Very well, thanks

I'd suggest that you get yourself an Arduino starter kit - Amazon has a bunch of different ones. Or you can do it yourself & buy breadboard, wires, leds, resistors, switches etc separately. A kit's probably better value and more fun. Blinking leds will only be a thrill for so long.

You'll need a soldering iron (and solder of course) and some header pins to permit you to attach that SD breakout board to your breadboard.

I'm from a software background, so I can see how the electronics side can be intimidating. Just start with the easy stuff, follow some tutorials (Arduino cookbook perhaps) and you'll soon wonder what you were worried about.

One major difference between hardware & software that I've observed is that with software, you can dig into your code to an arbitrary depth to debug it. With hardware, it may get to a point where you've dug as deep as you can and whatever's wrong is still hidden. A simple example of this is where you've wired a led up backwards - it's never going to work until you realize and correct it. The other thing is that hardware is less forgiving - you can bluescreen your PC and easily recover, but once you let the magic smoke out of an electronic component, shopping is in order.

wildbill: I'd suggest that you get yourself an Arduino starter kit - Amazon has a bunch of different ones. Or you can do it yourself & buy breadboard, wires, leds, resistors, switches etc separately. A kit's probably better value and more fun. Blinking leds will only be a thrill for so long.

You'll need a soldering iron (and solder of course) and some header pins to permit you to attach that SD breakout board to your breadboard.

I'm from a software background, so I can see how the electronics side can be intimidating. Just start with the easy stuff, follow some tutorials (Arduino cookbook perhaps) and you'll soon wonder what you were worried about.

One major difference between hardware & software that I've observed is that with software, you can dig into your code to an arbitrary depth to debug it. With hardware, it may get to a point where you've dug as deep as you can and whatever's wrong is still hidden. A simple example of this is where you've wired a led up backwards - it's never going to work until you realize and correct it. The other thing is that hardware is less forgiving - you can bluescreen your PC and easily recover, but once you let the magic smoke out of an electronic component, shopping is in order.

First of all thanks, I think you got the point: with software it's very rare something smokes :-) Moreover, when you plan your application (not just develop), you basicly know where you are going and what steps are involved.

As a software developer, I would stay away from soldering, for example, simply because of a sort of "politeness" mindset (not snobbery, to be clear) that maybe is less required in this context.