text:
Which Arduino microcontrollers are able to drive a parallel 8-bit ILI9341 display at 320x240@60fps with DMA or extra CPU core or both and how?
I've always wanted to make my own game console. I don't know why the existing Arduino game consoles have this issue with framerate when a 2006's Sony handheld PC had 1GB of RAM and an Intel CPU running Windows XP. Why haven't normal DIY open-sourcing copyright-libertarian hobbyists been able to make something at that magnitude? Don't say money because money is the reason I'm in gamedev scene; wanting to make a game console or anything that has a screen, characters, multimedia and nerdiness to make money.
So the issue has always been how do I find a microcontroller that's enough fast to run a 320x240 display like ILI9341 at 60FPS without stuttering or having to do lots of precalculations for partial screen updates. What about the NES/SNES consoles which didn't even have a framebuffer but which used discrete logic?

My scheme was to use ATXMEGA128A1U with a parallel bus and DMA, but it was hard to find a board containing all the stuff I needed and the External Bus Interface.
Then I tried to use ESP32 with SPI, but SPI would go max to 80MHz while the screen could only handle 40MHz.
Then I tried ESP32 again with 8-bit IO pin permutation which didn't work; it was too slow; maybe it would be faster if I used Xtensa assembly to take advantage of the CPU pipeline in case the dumb C++ compiler compiled machine code that waited 7 cycles for every next operation.
But now I'd like to use ESP32 with an I2S bus and DMA which was used for a camera demo and it was really really fast, but I'd like to use it for I2S output for that ILI9341 display. According to my calculations, it should take 10MHz to write out all of the bytes if the bus is 16-bit wide (8 bits for data and 1 bit for Data/Command register) + Read/Write/Select strobes controlled by the bus interface. However, Bitluni has been able to drive it to out of spec values of 580MHz for his VGA library that's superfast, but that month he had nothing to pay his rent with so he licensed the code under a copyleft license (ShareAlike). You know what they say, "The love of money and the lack of money are the roots of all evil.". Money is important, but really... this just makes money an even worse enemy than it was before.

So I guess I'm out of options. There have been many attempts and they have failed. Yes, there's Teensy and stuff, but I need something in the EU which I won't have to pay for more in shipping than the actual product.
So, what are the solutions?
P.S. if I get one of those "off-topic" or "too-broad" or dislikes to my question, I'm deleting it and moving to Reddit and screenshooting how yet again StackExchange is just too formalistic and banhammersome to open conversations.

While it's not a perfect solution for games, maybe this would interest you...

your post reads like a rant ... it appears that you may be trying to use equipment that is unsuitable for the task ... have you explored something like a Raspberry Pi?

Oh, and the root of evil is not money. The root of evil is -1.

Wow, especially the PS carried some deep anger. That really doesn't animate to give an answer :/

didn't NES have a hardware video controller? ... i think that one of the early game consoles had a 1-video-line buffer

@Majenko, an imaginary root

@jsotola So evil is imaginary?

@Majenko, i was trying to be funny, and failed ... lol ... technically, the root of all evil are people

@jsotola Funny... so was I... :/

Raspberry Pi is ShareAlike/GPL as far as I've been given the impression.

The problem is the whole concept of running an ILI9341 TFT screen at 60FPS from a microcontroller. You can't. It's just not fast enough.
To get those kind of speeds you need to directly interface the TFT panel with the microcontroller. And that takes a special microcontroller with a TFT interface built in.  As well as that you need the memory to store the image that you are displaying on the screen.
There are microcontrollers available that can do it quite happily.  But they aren't in the "maker scene". Simply because they aren't a common thing to do.
For many years now there has been the PIC24 "DA" range of microcontrollers with a built in GPU and TFT interface - but there is no free C++ compiler, so no Arduino support - so no easy route to using them for beginners.
There are now, though, the PIC32MZ "DA" rage which are more accessible - though still very hard to use.  These are much more viable for the kind of thing you want, with 32MB of built in DDR, a TFT panel interface, and available in a 144 pin TQFP chip that is possible for an experienced maker to hand solder.
But the barrier is still software.  While chipKIT has full support for the PIC32MZ "EF" range of chips the "DA" range is not yet supported.  That's not to say you can't work with them, just not with the Arduino API and IDE.
The more common way to make a games console like device is to take an ARM SoC and interface it with a TFT panel directly. The simplest way for a maker to do that is to put a TFT on a Pi and install Retropie.
And we're not against open discussion as people. It's the site. It's not a site for open discussion. It's a question and answer site. You ask a technical question that you need assistance with, and we tell you the answer. It's not a forum for general discussion.  As such, this question will be closed as either "top broad" or "primarily opinion based". However your question does deserve an answer anyway.

Thank you for the comprehensive reply and for considering my question.
Now, I've been working in AVR ASM and in Notepad++ alongside a MSYS32 for ESP32 development for Windows. So, if it's not Arduino, it's not a problem for me. All I need to know is how to access registers and the datasheet that proves the behavior of registers.
An ARM SoC would be good, but I don't want to be bothered with licenses and GPL and ShareAlike and EULAs and patents. Raspberry Pi along with Retropie are not permissive-licensed but copyleft. What ARM SoCs would be good then? Preferably a MIPS SoC?

MIPS is not ARM. Completely different architecture.  The problem with SoCs, especially ARM ones (which are prevalent these days) is the difficulty in getting into them. Not only are they hard to work with (generally high density BGA packages which means specialist production facilities that can handle micro-vias) but most SoC manufacturers want you to jump through hoops before they will even let you see a chip. Broadcom still won't let Raspberry develop proper GPU drivers for their chips because it would end up open source.

Allwinner are better in their openness, but still they are hard to work with.  A meaty MCU (200MHz or faster) with the right interfacing would be easier to get into, but the problem with them tends to be lack of memory. That's where a SoC excels - with the memory external (and DDR is another whole nightmare to develop for) you really aren't limited to what the manufacturer has decided to allow you to have.  When it comes to microcontrollers it really doesn't matter what architecture you go for. Personally I prefer MIPS (PIC32) because I was brought up on MIPS systems at

university (DEC Stations). The new boy on the block, though, Risc V, which is completely open, looks promising. There's some microcontrollers starting to appear. Risc V is based on MIPS, and is available as an open source core for FPGA development. So you could even roll your own system in an FPGA if you want to get really hardcore. That would give you the most flexible system - but again very expensive to get started with. Development tools are $$$$. Plus it takes a whole other set of skills to work with.

I know MIPS is not ARM. The comment length limitation didn't let me say fully. Anyways, I found a European seller of the Teensy 3.5. 3.6 is out of stock (as always). For some weird reason, I cannot find Teensy 3.5 LCD benchmark videos anymore. Google seems to be disranking all non-mainstream things to suck an extreme extent. I'd like to know more about Teensy 3.5 since it's the most powerful thing that's accessible with a decent shipping time/cost, but I need to know the availability of permissive licensed libraries and if 3.5 can do the superfast 3.6's 60fps rendering. I'm unable to get 3.6.


text:
4 Digit, 7 Segment Display Wiring (14 pin)
I purchased this 4 digit, 7 segment display from Adafruit:
Product: http://www.adafruit.com/products/865
Data Sheet: http://www.adafruit.com/datasheets/865datasheet.pdf
Everything I have searched for on the net either has 12 pins or 16 pins and most of those are only using 4 resistors.  This one has 14 pins.  I'm trying to wire it up to an Arduino but I'm not sure which pins should have resistors and which shouldn't.  If I wire it up like in the product picture with 1k resistors, I get 8.8.:8.8. and as I remove resistors from 5V, I can see the different sections that are lit/not lit.
Is that the correct way of doing it?  Can I now just wire those to the Arduino?

It's just a 12 pin display, but with two extra pins for the colon.
Removing connections can help you better understand what it going on.
Resistor should be added to the anodes (pins 1,2,3,4,5,8,9,12,13) just like on the website. Pin 8 should be a different value, to match the brightness of the other (multiplexed) leds.
The other end of the resistor can be put into the Arduino. Depending on the resistor value you may need to add some transistor to drive the other pins (cathodes) on the display. Lower value resistors means a brighter display, but too much current for the Arduino to drive all 8 leds of a digit at the same time.
1k resistors, would mean about 3mA of current per segment. So if all segments are on in one digit, that would be 8*3, so 24mA. Which is approaching the maximum current an Arduino pin can source.

Awesome, thanks for the reply.  I'll setup the wiring just like the product image, with 1k or slightly higher resistors to be safe.  What do you mean that Pin 8 should be different?  Is there a specific value is should be or what is the significance of that pin?  Sounds like you have used one of these before - do you recommend an Arduino library?

pin 8 is for the colon and it has two leds attached in parallel. Since you are multiplexing the digits, that means the leds are on only 1/4th of the time. So to match the brightness you'd supply the colon leds half the current. So I'd just double the resistor value for pin 8 (unless you're not going to use the colon at all). I just looked at the datasheet. No idea what libraries are good, but I think all will work just fine on your display.

Thanks - that makes sense about pin 8.  I was able to get everything working with a library I found (minus the colon for now).  I used 8, 1k2 resistors on each segment pin which should give me around 20 mA per pin and the brightness is still very good.  One final question, does it matter if the resistors are on the eight segment pins or the four digit pins?  I think the current would still be the same right?  I have limited space so I would prefer to use 4 resistors over 8.

No, that will not work. Having the resistor in the digit means the all the leds in digit share one resistor. So the more segments are on, the more leds have to share the current, the more dim they are. So a 1 will be much brighter than an 8.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Where can I find magnetic declination lookup table?
Is there a way to get approximate value of magnetic declination from GPS coordinates?
My Arduino-based device has a Magnetometer and a GPS, and uses magnetic declination in calculations. I would like to avoid having to configure it by hand.
I have found references to https://www.ngdc.noaa.gov/geomag/WMM/soft.shtml online, but the site seems to be down (Google has a cache of the site but not of the code).
Is there another way of getting magnetic declination from GPS coordinates? Doesn't have to be precise, +/- 10% would work just fine.

No, the North pointed by GPS coordinates are extracted using the velocity heading which would represent the true North. If you get the ECEF (earth centered earth fixed) coordinates from the GPS you can convert it to a local ENU (east north up frame) and calculate the heading from the velocity vectors (take a look here if you need the formulas for that).
However, this site http://www.magnetic-declination.com/ can provide you a estimate for magnetic declination at your location.
EDIT
From the comment I came across this topic which lead to this
you can play with the code provided and take it as a template for your needs to create a lookup table. The software used for creation of the files is the one present in the site you pointed. Just downloaded the linux zip file and tested it with the sample txt coordinates provided and all seems ok.
For the record the command used was (yes for some reason the extension exe is present but this is linux binary):
./wmm_file.exe f sample_coords.txt out.txt

which created a out.txt equal to sample output file provided. Now this file can be used by the function void build_lookup_table() (present on grab60_char.c) to build the lookup table you need.

I'm basically only looking for an offline lookup table of data on that site. I already have latitude, longitude and altitude coordinates (either hardware or software does the transformations already).

@frnhr I edit my answer with more info I came across, hope it helps you.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How to connect Arduino and Beaglebone
I am newbie, I am afraid of doing harm and getting a burned-out Beagle Bone Black. I have soldered this SparkFun Logic Level Converter - Bi-Directional.
I have several questions:

How can I check if my converter works correctly without connecting it to any board or at least only to an Arduino?
How should I connect all my schematic from bbb to converter and then to an Arduino. I have a bi-directional converter, BTW. Can someone draw a simple picture of how to connect?

I would be grateful for any help.

The simplest method of connection is just to plug the Arduino into the BBB's USB socket.  That way there's no level conversion or anything needed - you can just open the serial port and communicate through that - what could be simpler?
You can even install avrdude on the BBB itself and upload code (HEX files) direct from the BBB, and the BBB supplies all the power.

In addition to the other methods listed, which will both work, you could also use an Arduino that uses 3.3V logic and connect the serial/UART.
The Trinket: https://www.adafruit.com/products/1500?gclid=COGOxqq-z8kCFcYRHwodpL8P2A
Pro 328: https://www.sparkfun.com/products/10914


text:
Connect arduino to beaglebone black
I want to exchange some date between arduino and beaglebone, as far as I know, most arduinos works with 5v levels, so I need to convert 5v into 3.3v beaglebone in order to communicate with it.
Unfortunatly I have no pro mini 3.3v now, only 5v arduinos.
So I need to convert levels.
I have several questions.

I have UART TTL CP2102 converter, I am using it to programm my Arduino pro mini, can I use it directly with beagle bone without converter ? http://ecx.images-amazon.com/images/I/410n8%2BHhdNL.SY300.jpg like this.
I can buy this cable with pl2303 inside http://i01.i.aliimg.com/wsphoto/v0/32250361345/Free-postage-1pcs-PL2303-PL2303HX-USB-to-UART-TTL-Cable-module-4p-4-pin-RS232-Converter.jpg
Is it possible to power my arduino pro mini 5v with 3.3v supply and use it directly with beaglebone

Can you provide simple level converter schematic to solder it quickly

All in all I need just to communicate with beaglebone via uart from pc with USB-UART converter or from arduino it doesn't matter, just to communicate and send some data.
Please suggest what is the best way to follow.

The simplest way is just to plug the Arduino in to the BBB.
The BBB has USB.  The Arduino has USB.  Connect the two together and you have both power and data immediately available.
Depending on the Arduino and its version it will either be there as /dev/ttyAMA0 or /dev/ttyUSB0
You can even use avrdude to upload new software to the Arduino direct from the BBB.

Thx for answer, but I need UART communication

@solderingiron  Why? What's so special about using the UART pins that you can't achieve just as easily through the USB CDC/ACM UART emulation?


text:
What's on an Arduino board? Can i build one of these boards myself?
My question is: What is on an Arduino board besides the microcontroller?

https://www.arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

Welcome to SE-A! This is a very vague question. Are you talking components (which can be found in links provided by others), are you talking about block diagrams (features broken down by sections?). What have you looked at and what have you found? Can you build one yourself. Yes, quite easily. Should you? Depends. What do you want to achieve? There are plenty of clones out there which are a great place to start. They're cheap and take some of the guesswork out. If you like the guesswork, start with nano's or even breadboards.

When I first built my first Arduino clone, I fount very useful the Fritzing examples (boards and schematics). http://fritzing.org/home/
Mind that in order to upload sketches, an FTDI module is very handy (unless you use ISP via another Arduino board).
In any case, I should recommend you to build an Arduino clone on a breadboard, before trying soldering.
Good luck.
Additionally, you may use this picture (this is how  I create an Arduino on breadboard):

External power (battery) is connected to the screw pins (bottom left of the breadboard).

Yea thats my idea...

This list is probably not exhaustive but comes reasonably close:

A power supply (voltage regulator and filter capacitor);
A USB connector for powering from a USB port and passing data to/from
your PC;
A second processor (Atmega 16U2) for handling USB <-> serial data
conversion;
A barrel-jack for powering it from a 7 - 12v;
A MOSFET for selecting whichever power source is being used;
An LED connected to the chip's digital pin 13;
A pushbutton for manual reset and a capacitor for auto-reset;
A 16 MHz crystal and load capacitors;
Several lengths of female headers for connecting plug-wires or shields to the Arduino.

And yes, it's relatively easy to build one - instructive, too! There are how-to project details all over the Internet. I've hand-built any number of them, just soldering up whatever parts I wanted.
Here is an Arduino home brew project, CSEDuino, that was easy and fun to build, with good detailed directions. It is an Arduino clone that does everything the Uno does, except that it isn't physically compatible with Arduino shields.
All of my gadgets are on home-brewDuinos. I usually skip the USB connector and 16U2 processor, and keep one or two FTDI USB to serial cables on my bench to power or program whatever board I'm currently working on. I usually skip the auto-reset capacitor too, and manually reset the board to upload it.
Have fun building!
In service, I just power them from a USB wall charger. Any of them that need to communicate get an radio of some kind, usually Bluetooth or Wifi. Some of them just collect data to non-volatile memory for me read out later.


text:
Array deletion problem
I am a bit confused about how memory works in Arduino.  I have created an integer array like so:
int* arr = new int[3] {1, 2, 3};

When I go to delete it:
delete[] arr;

The first element is deleted, and all the remaining ones are still  present and accessible.
Serial.println(arr[0]); // prints 0
Serial.println(arr[1]); // prints 2
Serial.println(arr[2]); // prints 3

First of all: it is not a good idea to do dynamic memory maagement in embedded systems (in casu arduino)
Secondly freeing memory means: marking the memory as available. It does not mean "setting the memory to 0"
because ar still points to the same locaton in memory it is "normal" that it also still reads the old values. Only -according to the C CP0P0 pàrogramming rules- you should not do so. Reading will not cause problems but writing will very likely.

Deleting newed memory only informs the system that you are no longer using it and releasing it for re-assignment. The pointer still points to memory containing your array but that memory is no longer reserved for you. You could, in theory, go on using it, but another new might well reassign it for another use and the data that was in it would likely get over-written.
It would be good form to zero your pointer (arr = (int *)0;). It accomplishes several things:

Your code clearly reminds you that the pointer is no longer usable;
Your code clearly informs the next reader that the pointer is no longer usable;
An attempt to use the pointer is quite likely to fail immediately (depends on the envrionment's ability to trap attempted accesses to location 0). The alternative is your code may work anyway - until someday that memory actually does get re-assigned and suddenly, code that has worked "forever", breaks, and in a non-obvious way. Save yourself or the guy or gal who follows you some grief, and make it a habit to zero your pointers once they are no longer valid.

Note that arr = 0; is sufficient - you do not need to add (int*). 0 is defined for pointers.

It is not a good idea to use dynamic memory in such a small devices in general.
And delete doesn't mean setting values to something at all. It's just returning allocated memory back ("to system" is not correct term here as there is no system).
You should try to use objects with some action in constructor and destructor (like printing values).
For example:
class test {
public:
  test(int _i):i{_i} { Serial.print("test:"); Serial.println(i); }
  ~test() { Serial.print("~test:"); Serial.println(i); }
  int i;
};

void setup() {
  Serial.begin(57600);
  test * arr = new test[3] {4,6,9};
  delete[] arr;

}

void loop() {
}

prints:
test:4
test:6
test:9
~test:9
~test:6
~test:4


text:
4 channel Remote Control
I'm trying to make a 4 channel RC using Arduino and nrf24L01 module.
I already know how to deal with this module, but the question is "What does 4 channel mean ?", and how to make it supports 4 channel ?

Sounds like a class assignment? You might need to ask your teacher what is expected :)

4 channel means having the ability to send 4 individual values (maybe speeds?) at once.
Since the nRF24L01+ is a packet based system it is as simple as sending the different "channels" as different bytes (or groups of bytes if more than 0-255 or -128 to +127 is needed).
For instance, if you want 4 channels that can represent 0-255 then you need 4 bytes, and so you can set both sender and receiver to have a packet size of 4 bytes (for efficiency) and send a packet made up of the 4 channel values.
If you want to represent numbers bigger than that then you need to split the variable into bytes (two bytes for an int, 4 for a long) or create a struct to represent your packet of data. Of course you then need the sender and receiver to be set to a packet size at least big enough to contain the data, and both ends must agree on the packet size.

'Channel' here probably refers to something like these RF module types: http://electronics-diy.com/store/4-Channel_RF_Remote_Control.jpg. More like 4 bits/states really and a lot more direct than the NRF24 and far below its capabilities; there's no direct translation, I think.

@TisteAndii That then is just 4 values of a single bit resolution. It could be sent as the lower nibble of one byte in an nRF24L01+ packet. 'Channel' usually refers to one "pipe" of data values, such as in a radio control plane: pitch, yaw, roll, throttle (or tail flaps, tail fin, ailerons, engine). I suspect this is a (somewhat better) reposting of an earlier question that I cannot find now (probably closed and deleted) which was wanting to communicate with 4 channels for motor control or something. Or if not, the circumstances seem so similar as to make me think it's the same assignment.

You're right. I guess I just thought buying this module only for sending 4 bits is a bit wasteful, unless its for the range. But since the capacity is already being wasted, they might as well use 1 reading pipe per bit at the receiver. Have the transmitter use the pipe 0 to write a bit (a byte, really) to each of the receiver's 4 reading pipes, to better sell the whole '4-channel nRF equivalent'.

The whole concept of "channels" only has any real meaning when talking about analog communications anyway. With digital it's all packets. "Channel" is used to indicate the precise frequency it operates on.


text:
Is there a good XMPP (Jabber) library for Arduino?
I have a few sensors plugged in and getting some data from them. I want to use XMPP protocol to push the sensor data to my main server. Is there a good XMPP library available which I can use?

A quick search pulls up https://github.com/adamvr/XMPPArduino which hasn't been touched since it was first created five years ago, and may or may not work. XMPP is a very heavy protocol that is very burdensome for a microcontroller to try and run. You could try and get the above library to work, or I would recommend one of the following alternatives:

Load an XMPP client onto the OpenWRT side of the Yun and send commands from the Yun to control it. (Although glancing through the list of packages, there does not appear to be a pre-existing one. So this might not be an option unless you are up for cross compiling one. Looks like there is at least one: BitlBee via https://github.com/arduino/openwrt-packages-yun)
Have the Arduino communicate using a lighter weight protocol (e.g. HTTP or MQTT) to another server or application that you write, which in turn sends your XMPP message using a readily available library.


text:
pySerial and serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected?)
I'm having some trouble getting my arduino uno to communicate with a simple python script through pyserial.
Lets start with my arduino sketch:
void setup() {
  Serial.begin(9600);
}

byte i = 0;
void loop() {
  Serial.println(i);
  i = i + 1;
}

Really dead simple. It just spews the numbers from 0 to 255 over and over again. It works fine in the arduino serial monitor and gets me the expected result.
The python script comes from:
http://playground.arduino.cc/Interfacing/Python
import serial
ser = serial.Serial('/dev/ttyUSB0', 9600)
while True:
    print ser.readline()

However running this script gets me:
$ python test.py
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    print ser.readline()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 460, in read
    raise SerialException('device reports readiness to read but returned no data (device disconnected?)')
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected?)

I am using ubuntu 14.04 and python-serial_2.6-1build1_all.deb

This may be a kernel bug. See here: https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1501240
The workaround it seems is to use kernel 3.13.0-63-generic.
You can change the kernel for a one-time boot by holding shift while starting up. To make the change persistent, you need to edit /etc/default/grub: https://askubuntu.com/questions/262965/grub-timeout-set-to-0-cant-access-grub-menu-anymore?rq=1


text:
How to use serial.read a sentences and serial.print after that enter to new line
This is my code but it doesn't work. I don't no why . I hope someone can explain the problem. Tks
unsigned char InTransfer;
char buffer;
void setup()
    {
  Serial.begin(9600);
}

void loop()
{
  /* when get the sentences and print it*/
   while ( Serial.available())
  {
    buffer=Serial.read();
    Serial.write(buffer);
    InTransfer=1;    // detect
  }
  /* After done enter one time */
  if (Serial.available()==0)
    if(InTransfer==1){
      Serial.println("");
      InTransfer=0;
  }
}

Can you provide more information? What doesn't work? Does it compile? What is it meant to do?

Your code works perfectly, I don't see a problem with it. It's doing exactly what you're telling it to.
The problem lies in a fundamental lack of understanding about how serial communications work on your part, so you are telling it to do the wrong thing.  Until you fix that aspect no program you try and write in this way will be a success.
You should start by learning how serial communication actually works.  A good starting point is an article I wrote ages ago: http://hacking.majenko.co.uk/reading-serial-on-the-arduino

Can u tell me how to fix this problem ? or give me an related example because I don't understand more. Thank you

@giangphuc Follow the link. Read the text.


text:
LM35 at higher temperatures
I have a question concerning the LM35 sensor: if I'm not too concerned about accuracy (I don't mind having 2 or more degrees off), is it possible to use the LM35 sensor at higher temperatures than the normal range? The project that I'm thinking of using this sensor, temperatures should reach 200 degrees, maximum.
Thanks!

No, you cannot.  The LM35 is rated for an absolute maximum junction temperature of 150°C.  Any higher than that and you will damage it.
For temperatures above that you are better using a thermocouple.

Thank you for your answer. For this project, I want to keep costs low ― so I might try to make my my own thermocouple. I don't know if I will be able to make a good-enough amp at a low cost, though. If anyone else is interested, here are a couple of things that might be useful:
http://hackaday.com/2015/04/06/how-to-build-a-thermocouple-amplifier/ - how to build a thermocouple amp;
https://en.wikipedia.org/wiki/Thermoelectric_effect#Seebeck_effect - the effect that makes it possible to calculate temperature using two different materials;

A thermocouple interface is not expensive on eBay.

Unfortunately I don't live in the US. Compared to the lm35 or thermistors, thermocouple are pretty expensive around here.


text:
EthernetUdp2 does not name a type
I'm using arduino Ethernet shield 2 form arduino.org and the arduino IDE 1.7.10 also from arduino.org
the code is :
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet2.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp2.h>
#include <Twitter.h>
#include <util.h>

#include<SPI.h>

EthernetUdp2 udp;
void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

and it is giving the following Error :
Arduino: 1.7.10 (Windows 8.1), Board: "Arduino Uno"

UDPMessages002.ino:14:1: error: 'EthernetUdp2' does not name a type

Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

after Enabling Show verbose output I got :
Arduino: 1.7.10 (Windows 8.1), Board: "Arduino Uno"

Build options changed, rebuilding all

Using library Ethernet2 in folder: C:\Program Files\ArduinoOrg\libraries\Ethernet2

Using library SPI in folder: C:\Program Files\ArduinoOrg\hardware\arduino\avr\libraries\SPI

C:\Program Files\ArduinoOrg/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=107010 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files\ArduinoOrg\hardware\arduino\avr\cores\arduino -IC:\Program Files\ArduinoOrg\hardware\arduino\avr\variants\standard -IC:\Program Files\ArduinoOrg\libraries\Ethernet2\src -IC:\Program Files\ArduinoOrg\hardware\arduino\avr\libraries\SPI C:\Users\friend\AppData\Local\Temp\build8617491196975133384.tmp\UDPMessages002.cpp -o C:\Users\friend\AppData\Local\Temp\build8617491196975133384.tmp\UDPMessages002.cpp.o

UDPMessages002.ino:14:1: error: 'EthernetUdp2' does not name a type

Error compiling.

any Help please
These libraries came with the IDE and were not added by me and all the includes
were added automatically after using Sketch --> Import Library --> Ethernet2

The error you see, 'EthernetUdp2' does not name a type, means exactly that - there is no type EthernetUdp2 defined.
If you look at the source of EthernetUdp2.h, you'll see that the class declaration is EthernetUDP. See:
class EthernetUDP : public UDP {
    private:
        // Private members...
    public:
        EthernetUDP();  // Constructor

      // Public members...

};

class EthernetUDP : public UDP defines a class called EthernetUDP that inherets from the base class UDP. The constructor is what gets called when you instantiate a new object of type EthernetUDP.
Replace the line EthernetUdp2 udp; in your code with EthernetUDP udp; and it should work because the types will match. For reference:
#include <Dhcp.h>
#include <Dns.h>
#include <Ethernet2.h>
#include <EthernetClient.h>
#include <EthernetServer.h>
#include <EthernetUdp2.h>
#include <Twitter.h>
#include <util.h>

#include<SPI.h>

EthernetUDP udp; // <---- This works

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Which one do you mean ?

class EthernetUDP : public UDP {

here ? or here : public:
EthernetUDP();  // Constructor

The first one. I'll edit to make it more clear.

but I'm using Ethernet shield 2 not 1

Right, but the class name is still EthernetUDP in the Ethernet2 library

As it was answered above by Cheirbriados, the library is EthernetUdp.h not EthernetUdp2.h. I'll post you an example code, but you can also analyze it by yourself, by going on tab Examples of the Arduino IDE and choosing Ethernet -> UDPSendReceiveString:
#include <SPI.h>         // needed for Arduino versions later than 0018
#include <Ethernet.h>
#include <EthernetUdp.h>         // UDP library from: bjoern@cs.stanford.edu 12/30/2008

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 1, 177);

unsigned int localPort = 8888;      // local port to listen on

// buffers for receiving and sending data
char packetBuffer[UDP_TX_PACKET_MAX_SIZE];  //buffer to hold incoming packet,
char  ReplyBuffer[] = "acknowledged";       // a string to send back

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;

That library is for the legacy Ethernet shield. The Ethernet Shield 2 (which the OP has) uses the Ethernet2 library, so your answer is likely incompatible with their hardware.


text:
How to connect IR Transmitter and Receiver Module?
The IR Transmitter and Receiver module has both receiver and transmitter in same board. I tried Arduino IR Remote library example to decode Remote signal using below connection, but its not working.

IR MODULE:   ARDUINO
Ground   ->  Ground
5V       ->  5V
RXD      ->  PIN 11
TXD      ->  PIN 10

The board also has 3 pin connector (Gnd, 5v, S). How to connect pins to Arduino to receive/decode and send IR signals? (Can't able to find any tutorial for this type of board)

Example Code:
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
  delay(100);
}

That is not the sort of IR circuit one would normally use with an Arduino, rather it looks like it has some sort of on-board modulator or something.  Your question will not be answerable until you find full data on the module.  For ordinary arduino projects, you just want a loose receiver module and a loose IR LED, resistor and NPN transistor.

This particular question would be more easily answered if a link to the device was provided. I'm interested in the product, as it appears to answer a question I have not posted. This device appears to be suited for reflecting the IR signal from a distant surface, but it would be necessary to physically isolate the emitter diode and the receiver in order to prevent false signals. You say you are unable to make this item work with the code provided. Please clarify what portion does not work as expected and also what steps you have taken to narrow down the problem.

The given code doesn't seem to make any attempt to transmit or enable a transmitter on the module, which has both transmit and receive pins.  This seems unlikely to work.

@fred_dot_u I just connected this device to Ardunio and uploaded above sample code. Then given IR signal from my remote...But it now showing in serial monitor

Google the part number: YS-IRTM. I found a post on the Arduino Forum for example which describes using this device. There is also a YouTube Video.

The device in the question is commonly sold on aliexpress.com and the likes of ebay.com.  As you might guess there is little in the way of documentation.  Without documentation we can only speculate.  As such, I expect that the module handles all the modulation and demodulation.  It is likely all you need to do is use the Arduino serial library and connect the TX and RX to the Arduino's RX and TX pins.  However, if you would like to preserve the function of these pins for use with the Arduino Uno's USB port, you can use the Arduino software serial library which will "emulate" a serial port an an unused (alternate) set of pins.
(This is an example of a similar well documented device with access to the schematic and source code.  Armed with this type of knowledge you can turn this device into what ever you want.  In other words, you probably don't even need an Arduino.  You can just program this device and be done with your project.)

Connecting additional devices to the hardware UART RX and TX of a classic ATmega328p type arduino is possible but will interfere with the usual connection to the computer.  People usually use a software serial implementation or a chip with more hardware UARTs.

True.  Was just using an ARM based Arduino which, I'm hoping, doesn't have that problem.  I'll change the answer around to accommodate the difference.

I think you need to switch RX and TX in your code. Looking at the video that @nick-gammon reffered to. TX on audrion is RX on device.

Thanks. I have similar module and i just switched up rx/tx and all works fine

it use UART protocol so your code is wrong.
Here link with code

For that module you dont need library for easy example for sample for send HIGH and LOW status but. it doesnt work for control IR protocol. for that you need the basic conection Just (data-gnd-Positive)   in that example data is for pin = 11

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Arduino long distance cable tester
We have a 50 pair cable running about 1.5-2 KM with some services running on different pairs. One pair has recently become intermittent and is losing connection for 1-2 seconds at random. It might happen a few times an hour, so I jumped the service onto another pair. There is a modem connected to the pair for communication between two sites.
When resistance tested with a multi meter with a loop in one end it was reading 330 Ohms. When using an oscar meter it was reading -2.4db which is the same readings for other pairs.
I would like to use an Arduino to monitor the line resistance for a few days and see if there are any spikes or breaks in the line. I was going to use an analog input as a multimeter by using a known resistor and the looped pair as the other resistor.
Does anybody think this will not work?
How else could I go about this?

Sure, no reason that wouldn't work. For best results you want a known resistor of about the same resistance as, or a little below, the one you are measuring.
However, if what you are seeing is an actual open circuit then there's little benefit to measuring the resistance - you may as well just treat it as a switch or button, give it a large pullup, and use a digital input (or even an interrupt) to give a simple "OK / ERROR" signal.

It does not appear to be an open circuit i think. But i was worried the 5v dc wont get around the line and back with voltage drop?

The voltage drop is dependent on the current and the resistance, and the current is dependent on the resistance and the voltage...  (simple Ohm's Law). If you use a 100Ω resistor that's 430Ω with 5V across it, which gives you 11.6mA flowing through the cable.

Thanks. I will try tomorrow. When i connect 12v to the line i only read 8v coming back on my multimeter which is confusing me.

That statement makes no sense. If you have a closed loop there is no "coming back" to measure.

Picture this. Positive lead connected to one wire of the pair. Pair looped/shorted at far end. Mete probe connected to returning wire and other probe to negative lead of power supply. Reading 8v.

That's not how you measure voltage. You measure voltage across something, not through it.

Effectively Im measuring the voltage between the power supply pos and neg. But with the cable pair acting as an extension of the positive lead . Not through anything. I was expecting to see 12v.

You would see 12v minus the voltage drop over the resistance of the wire caused by whatever current the meter was drawing. Since that is an unknown value the voltage measured is meaningless.

For data communications the problem is often more complicated than DC resistance. Data signals are AC, and subject to impedance, (not simple resistance) inductance, and capacitance, as well as RF interference. A pair that's fine for slow on/off switching of DC signals may not be fine for higher frequency data signals.
You can also get intermittent shorts between wires in one pair and other pairs, even if the connection between the wires in the test pair are fine.
Back in the day I worked for a company that sold and serviced mini-computers to the US House of Representatives. The house offices would run serial cables up through walls and ceilings, and also under carpets. We had some flaky cables, and finally figured out that the offices would run the cables under the carpet, but over carpet tack strips. As people walked over the carpet, it would sometimes cause the tack strips to poke through the insulation, causing shorts and RF noise in the cables, which would mysteriously go away later.
Checking DC resistance will let you find breaks in your wires, but you can't assume that if the DC resistance looks good, the pair is good.
I would suggest using a simple voltage divider and one of the input lines on the Arduino for simple resistance testing, but that will only get you so far.
What you really want is a signal generator and an oscilloscope. You should send test signals (With voltages and signal patterns that resemble your data signals) down one pair at a time, and look at the signals on the far end, checking all the pairs. You should see your test signal come through, with the wave pattern still recognizable on the target pair, and no significant leaking of the signal to other pairs.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Arduino Accessing a web page
Folks,
I want to use my arduino with ethernet shield to access the following webpage "http://www.met.ie/forecasts/sea-area.asp" and take some information.
On the website it has a line "Small Craft Warning"- This is always either "In Operation" or "Nil".
Basically i want to hook up a RGB LED to the duino and if "Small Craft Warning" is "in Operation" i want LED to be Red, and if "Nil" LED can be green.
My issue is i cant figure out hot to go about getting the information from the webpage.- Can the arduino read this directly?
I am confident with arduino but this is my first web based project!
Any Tips or advice would be savage helpful
Thanks

As I commented on deltaray's answer, a regular expression library is
overkill for finding a fixed string. There is a standard avr-libc
function for that called strstr():
char * strstr(const char *haystack, const char *needle);

where haystack is the Web page and needle is the fixed string you
are searching for.
There is an issue with this function though: in order to use it, you
need to have the whole haystack in RAM. For a non-trivial Web page, this
may not be doable on a small Arduino.
Below is a custom solution based on a finite state machine: the
parser can be in a number of different states:

state 0 = waiting for the 'S' of "Small Craft"
state 1 = waiting for the 'm' of "Small Craft"
etc...

The state is actually an index in a character array representing the
string we are looking for. Each time the parser finds the expected
character, it moves to the next state. Otherwise it moves back to state
0. There is a small kludge though: when in the state waiting for the
'N' of "Nil", if it doesn't get an 'N', it moves to the state waiting
for the 'I' of "In Operation" and tries the match again. This way it
can look for both the possible strings at once. Also, once it got the
full preamble "Small Craft Warning: </b>", if it gets something
invalid, it moves to an extra state called INVALID instead of state 0.
Here is the code:
// Possible return values of parse_forecast().
// The last three are sticky.
enum parse_state {
    NO_PREAMBLE,        // no complete preamble seen yet
    PREAMBLE_COMPLETE,  // preamble just completed
    PARTIAL_NIL,        // received preamble and start of "Nil"
    PARTIAL_IN_OP,      // received preamble and start of "In Operation"
    COMPLETE_NIL,       // result = Nil
    COMPLETE_IN_OP,     // result = In Operation
    INVALID             // valid preamble followed by invalid data
};

parse_state parse_forecast(char c)
{
    // position:      0                        25   29            42
    const char T[] = "Small Craft Warning: </b>Nil\0In Operation\0";
    static size_t i;  // T[i] is the character we expect next

    if (T[i]) {  // non-sticky state
        if (i == 25 && c != T[i])
            i = 29;      // switch to "In Op" branch
        if (c == T[i])   // found expected char
            i++;         // wait for the next one
        else {
            if (i < 25)
                i = 0;   // reset to start of the string
            else
                i = 42;  // invalid state
        }
    }
    return i <  25 ? NO_PREAMBLE :
           i == 25 ? PREAMBLE_COMPLETE :
           i <  28 ? PARTIAL_NIL :
           i == 28 ? COMPLETE_NIL :
           i <  41 ? PARTIAL_IN_OP :
           i == 41 ? COMPLETE_IN_OP :
           INVALID;
}

With this you do not need to store the Web page in RAM. Instead, you
feed the parser one character at a time and, at the end, check the
return value. You expect it to be either COMPLETE_NIL or
COMPLETE_IN_OP.
Implementation detail: there are three NUL characters in the template
string, at positions 28, 41 and 42 (the last one is implicit). They
correspond to the three possible "sticky" states.

Unfortunately that text is delivered as part of the complete web page and not, for example, an AJAX request.

Do you supply an RSS feed of your forecasts?
This is not something we provide at present, although we hope to do so in the future. Source.

Your only option is to scan through the whole page looking for the text strings.
This is a little dangerous as the page could, for example, contain the phrase as part of a help file and give you an incorrect status reading. I wouldn't set to sea on the basis of your LED.
Bí cúramach!

I think this can be accomplished with the use of a few libraries.  Also, I'd recommend the use of a third color to let you know when your program has encountered an unexpected condition, such as couldn't retrieve the webpage or couldn't find "Small Craft Warning" in the page or if the value for that attribute is something unexpected.
So first you'd want to use the Ethernet library that comes with the Arduino IDE. There is even an example sketch that shows you how to use it to download a webpage. Make sure you parse the status returned from the webserver to ensure its giving you a 200 HTTP status code and produce an error if it does not or if the connection fails.
As for parsing the webpage itself, you might try this regular expression library that Nick Gammon wrote.
Just have it search for the line with Small Craft Warning and then parse that line as a string as test for matches against the strings you are expecting to find or erroring out. Or you can use additional regular expressions to match your expected values once you find the right line. Remember to make the LED show an error color if it doesn't find the line or an expected value.
Just talking about this makes me want to try it. ;-)

Using a regular expression parser to find a fixed string is kind of overkill.

Just trying to make it easier for them.

Thanks. This is awsome help. Just read the readme and its brilliant but im just not getting it.  I dont know where to start

If you're trying to go from 0 to parsing a webpage with an arduino, you're pressing too hard on the gas. You need to work your way through some other examples and tutorials first, then it will all make more sense. And you'll have a lot of fun along the way.

To add to Transitor's answer, while not guaranteed to work perfectly, you can always try to narrow down the page's source by only searching the component the text is in which should hopefully work. (unless they redo their website)

Thanks...I have no clue how to code that. And cant find examples. Any hints?

Simply use if (String.substring(length of element data here) == "element name here") {} to find it on the webpage and then execute whatever code you need inside

what is lenght of element data representing?

Go into the source code of the website you wish to get (you know how to in chrome right?) and copy the html element which contains said text into the "element name here" part of the code and put the length (in chars) in place of the "length of element data here".


text:
Stuck in While loop!
I am using 4 LDR To track the sun for solar panels. Not using servos, but linear actuators(a little irrelevant but just to give scope)
my code gets stuck in this while loop as soon as it enters it, even tho the conditions are changed to break the loop. I want to leave the motors running in one direction until the "dvert"=Vertical difference is less then "tol"=tolerance. there are 4 of these loops. there is an if condition before each. so no adjustment is made if its already in tolerance.
Segment of code
  if (avgtop > avgbot)
  {  Serial.println("enter avgtop > avgbot");
    Serial.println( "");

   while (abs(dvert) > tol)
     {
      Serial.println("Enter While loop vert up....");
      Serial.println("Moving Vertical Axis begin...Moving UP  ");

                   digitalWrite(vrelay1, HIGH);              // Setting frame down
                   digitalWrite(vrelay2, LOW);              // Setting frame down
      delay(200);
      int topl = analogRead(ldrtopl);
      int topr = analogRead(ldrtopr);
      int botl = analogRead(ldrbotl);
      int botr = analogRead(ldrbotr);
      int avgtop = (topl + topr) / 2; //average of top LDRs
      int avgbot = (botl + botr) / 2; //average of bottom LDRs
      int dvert = avgtop - avgbot; // check the diffirence of up and down

      Serial.print("NEW DVERT:"  );
      Serial.println(dvert);

  }  ```

don't use a while loop .... use an if block .... the loop() function in the sketch already loops

Unfortunately, for delay reasons, i need to use the while loop. I want the system to delay at the end of the big loop after everything is aligned

why do you need a delay? .... if you really need a delay, then do a delay only when there is no motor position to be updated .... that is simple to accomplish with the use of a flag variable

The delay will allow the system to sleep for a set time to allow the sun to move a reasonable distance before tracking again.

just do something like this pseudo code  if (go left) {runMotor(left); moving = true;} else {moving = false;} ... if (go right) {runMotor(right); moving = true;} .... if (!moving) { pause 10 seconds} else {pause 1 second}

Thanks might give it a try.

But still lost as to why the while loop wont terminate

Your output of dvert should show you why the loop does not terminate.

The output dvert is initially >tolerance, but value is changed to < tolerance but the loop keeps looping. Im lost.

"delay will allow the system to sleep" WRONG. delay rather only blocks the system, and is nice for quick and dirty demo code. As loop() loops, just let it loop without actions, if no action is required.

You're masking your outer dvert variable (and potentially others that you want to keep) with local variables inside the loop:
  int dvert = avgtop - avgbot; // check the diffirence of up and down

If you're just assigning a new value to an existing variable you do not want to declare a new variable!
Instead it should be just:
  dvert = avgtop - avgbot; // check the diffirence of up and down

And the same for anything else inside the loop that you want to assign to a variable that you have created outside the loop.

you are the man. It works now.I nearly started fro scratch, Thank you so much


text:
ESP12E Boot vs SPI
I was wondering how I could overcome the next issue;
My ESP8266 12E is connected as follows:

GPIO0 ground if needed to program, vcc otherwise
GPIO2 vcc
GPIO15 ground

Bootmodes explained in the this schematic
I also want to connect a MCP3002 to my ESP. However to use SPI I also need the GPIO15 pin to be connected to the Chip Select pin.
MCP connections explained in this article

I tried connecting the GPIO15 pin from the ESP to the CS pin of MCP3002 and connecting ground in between. This did not work though, should I switch/remove the ground after boot somehow?
(Or should I connect it differently?)

The io 15 is SS if esp8266 is slave. If esp8266 is SPI master, you can choose any free pin as CS of the slave.

The esp8266 arduino boards package SPISlave library examples have a solution for master if esp8266 is slave.
The state of the boot pins is required only at boot. You should wire boot pins over a 10 kOhm resistor to create a pull-up/pull-down which can be override by pin output state to use the pins for devices which are OK with or need pull-up or pull-down, for example momentary switches (buttons).

I suppose my ESP8266 is the Master and my MCP3002 is the Slave? This means I can connect the MCP3002 CS to any other available pin of the ESP8266?

Thank you, I will try it tonight and will give feedback what it does!

the libraries you use are old and I don't see how to change the CS pin. I would try to use some other Arduino MCP3002 library with the standard SPI library of esp8266 boards package

I have no idea what you are talking about. This question is about wired connections and has nothing to do with libraries. The links are only a reference for wires, not for libraries what so ever,..

the article in second link has link to libraries

Thanks! It works like a charm =). Can you also give some more info / background on why I can use any pin and not just the CS pin?

SPI is a bus. on master you need so many pins CS pins as many devices you attach to it. this CS pins are not handled by the MCU's SPI peripheral, but by the library. if SPI peripheral of the MCU is in slave mode it must use the dedicated pin. it is true for ATmega MCUs and for esp8266. but some other MCU can map different pins to peripherals. and as other exception  the SPI peripheral on the esp8266 has a strange mode of overlapping SPI which can use only dedicated CS pins in master mode to share with other devices the SPI interface dedicated to flash memory.


text:
Analog reading with noise - Arduino Uno VS ESP12e
I was testing analog output from a microphone (Max9814) with an Arduino Uno, which came with nice results. The output provided by the microphone is converted into sound and is loud and clear.
Setup: (Max to Uno)

Pin Vdd to 3,3V
Pin GND to GND
Pin Out to A0

However when I tried to set it up with an ESP12e instead of an Uno, I got a lot of 'noise' and no clear sound at all.
Here I used the following setup: (Max to ESP)

Pin Vdd to VCC (VCC is measured at 3.3v with a multimeter)
Pin GND to GND
Pin Out to AD0

A little 'side step'
The problem arised that the analog output from the microphone delivered a voltage of around 1.24, while the ESP12e analog has 1v as max input. This made the analogRead max out all the time. For this reason I put a 10k OHM resistor between the OUT and AD0 combined with a 20k OHM resistor between gnd and AD0. This resulted into nice analog readings (instead of 1024, around 400-500 all the time).
However, like mentioned before, a lot of noise is in between and the sound is not clear. (I also tried to work with 'sample windows', here is the 'filtering mechanism' which can be found on many sites/questions and works perfectly fine):
//(global logic is set to take n samples and than print the line)
//Tried n of 5 to 20
//Also instead of just samples tried the micros variant instead of just samples which is also found on many sites to create a time window to record.
unsigned int sample = analogRead(A0);
if (sample < 1024) {  // toss out spurious readings
  if (sample > signalMax) {
    signalMax = sample;  // save just the max levels
  } else if(sample < signalMin) {
    signalMin = sample;  // save just the min levels
  }
}

unsigned int peakToPeak = signalMax - signalMin;  // max - min = peak-peak amplitude
Serial.println(peakToPeak);

Does somebody have a clue why the Arduino gives such clear and good sound, while the ESP12e does not. (The analog values do not 'seem' to differ much in the levels)

The ESP8266 is an incredibly (electrically) noisy environment.
Because you can't use anything except the internal voltage reference, which is in turn driven from the internal noisy power, you can't get anything even vaguely approaching stable readings.
It is recommended to disable the WiFI completely ("Modem Sleep") when doing ADC readings to reduce noise.
However, the ADC was never intended for this kind of work. Its primary role is for monitoring the battery voltage of your hardware - and as such it really doesn't care that much about noise, since you can average a number of samples for greater accuracy (something you can't really do with audio).

So that means I should chain (somehow?), for example, the Arduino to the ESP and 'pass' the data through the esp to send it away?

Sure, you can do that. You could also attach an external ADC chip with a proper stable voltage reference to the ESP8266.

Ah, that is a very good note. Something like this?:
Analog to Digital Converter - MCP3002

Sure. That's pretty much the same as the ADC in the Arduino.

Thanx for the feedback, very much appreciated!


text:
ESP8266 ESP-12 Connection
I am connected with my ESP-12 through a programmer and all the AT functions work correctly. However I do not get a connection when connecting to the ESP8266 module.
I have done the following:
Set the mode both: AT+CWMODE=3
Connect to an Access Point: AT+CWJAP="<name>","<password>" (Responds with WIFI Connected and WIFI Got IP)
Set the Access Point: AT+CWSAP = "<other_name>","<password>",<channel>,<password_security>
So at this time it should be connected to my local network and I can connect to it through wifi on my laptop. However when I connect to it, it says 'Connected, No Internet' (The network the esp8266 module is connected to, has internet).
When I troubleshoot problems it says DNS is not responding.
Does anyone have a clue what to do next? Or what I might do wrong?

ESP8266 isn't a router. It doesn't route your laptop traffic to the AP with the internet.

Also this problem has nothing to do with Arduino.

It is an Arduino like module which can be set with Arduino and is able to be set as Access Point so it should be able to connect and have internet,..

make sure to set your AP to the same channel as the STA.

@dandavis Thanx for the good tip! :) But I indeed made sure the channel was the same.

You mention that in many different circumstances that you are somehow "connected" to something. But I have no idea what you mean. (Perhaps you tied them together with a piece of string? Or wired together two terminals but left both devices turned off?) You need to say not that you were "connected" but that you performed a specific test and got a specific response, e.g., "From my laptop, with IP address 1.2.3.4, I pinged 1.2.3.5 and got back a response." Also, giving us a link to the documentation from which you're working would be handy.

You can make the ESP8266 behave as a router, see Google for details.  By default it won't do this.
You need to create two separate WIFI networks and then tell the ESP to 'route' traffic between them.
Your ESP needs to form one network (STA mode?).  Your laptop needs to be on one network with the ESP.  The laptop needs to be configured to use the ESP as the gateway and unless your ESP has a DHCP server the laptop needs a static address.
Your ESP also needs to be a client to you router's network, and needs to take an address from the Router's DHCP server.

authors: Сергей Кобрусев


text:
Message received with 1 character less
I have the following situation:
One Arduino Uno with a 433mhz transmitter wired to the laptop to have serial communication. Another Arduino Uno with a 9V battery wired with a 433mhz receiver and an LCD screen (16x2, I2C).
I have the following code to transmit:
#include <VirtualWire.h>

void setup() {
  //Force low when enabled
  vw_set_ptt_inverted(true);
  //Set pin 12 for transmitter
  vw_set_tx_pin(12);
  //Setup with speed of the data transfer.
  vw_setup(4000);
  //Set serial communication at 9600 baud
  Serial.begin(9600);//set Serial
  //Set pin 13 to light up when transmitting
  pinMode(13,OUTPUT);
}

void loop() {
  //If message send via serial monitor
  if (Serial.available()) {
    //wait a bit for the entire message to arrive
    delay(100);

    while (Serial.available() > 0) {
      //Read serial into string
      String message = Serial.readString();
      //Initialize char array
      char msg[message.length()];
      //Write string to char array
      message.toCharArray(msg, message.length());
      //send char array as unsigned int (bits)
      vw_send((uint8_t *)msg, strlen(msg));
      //Wait until the complete message has been send
      vw_wait_tx();
      //Turn on light when finished
      digitalWrite(13,HIGH);
      delay(200);
    }
  }else{
    //Turn off light
    digitalWrite(13, LOW);
  }
}

And the following code to receive a message and print on a LCD screen:
#include <LiquidCrystal_I2C.h>
#include <VirtualWire.h>

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

void setup() {
  //start up LCD with 16 chars with 2 lines
  lcd.begin(16,2);
  //Turn on backlight
  lcd.backlight();
  //Write initialising message
  lcd.setCursor(0,0);
  lcd.print("Initialisation..");
  //Force low when enabled
  vw_set_ptt_inverted(true);
  //Set pin 12 to receive
  vw_set_rx_pin(12);
  //Setup with speed of the data transfer.
  vw_setup(4000);
  //set pin 13 for light
  pinMode(13, OUTPUT);
  //Start receiver
  vw_rx_start();

  //Set message on LCD that setup has completed
  lcd.setCursor(0,1);
  lcd.print("Completed!");
}

void loop() {
  //initialize array for message
  uint8_t msg[VW_MAX_MESSAGE_LEN];
  uint8_t msgLength = VW_MAX_MESSAGE_LEN;

  //If message received
  if (vw_get_message(msg, &msgLength)){
    //Turn on light
    digitalWrite(13, HIGH);

    //Print on lcd
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.write(msg, msgLength);
  }else{
    //Else turn of light
    digitalWrite(13, LOW);
  }
}

My problem is that the message that is being transmitted and received by the other arduino always is short 1 character. For example if I send "test", it receives and displays "tes". What am I missing?
(My short solution was to just add a space to the message, then the space got cut off. But I want to understand what is going wrong.)

One thing that immediately jumps out at me is your flawed serial methodology. You should read this: http://hacking.majenko.co.uk/reading-serial-on-the-arduino

I haven't found the source of the problem by reading through the code, and will limit my comments to advice about debugging the problem.
With the code as it stands, there are half a dozen points where the missing character might have dropped out.  With just a final result, the problem location is difficult to narrow down.  Modify your code to display intermediate data.
For example, in the sending code, print the read-in string and its length to Serial.  Eg, if you #include <Streaming.h> you can say:
Serial << message << ' ' << message.length() << endl;
Serial << msg << ' ' << strlen(msg) << endl;
and so forth.
[Note, msg actually occupies strlen(msg)+1 bytes, the last byte being a null-byte terminator, which your code doesn't send or receive.]
In the receiving code, besides the lcd.write of msg, do an lcd.print with msgLength.
You can also do some code clean-up in the sender.  Remove the line
while (Serial.available() > 0) {,
and its corresponding }, because  Serial.readString() already contains a character-wait loop with timeout.

Thank you for the tips. Im not that familiar with serial/arduino, just started. So these comments about the code are nice!


text:
Reading data from the MCP3002
I am using a MCP3002 to convert an analog signal to digital data. It works fine actually, sends good data. However; After a while, when the power is turned off and on again a few times, it only returns zeros. If I Power it on the next day, it works for a while again.
I am just beginning with SPI, so I do not know 'all' the basics. Is there something I should reset when powering on or something? (Clock, Timing, etc.)
This is the code I am using (pretty straightforward):
#include <SPI.h>
SPISettings spiSettings(7280000, MSBFIRST, SPI_MODE0);
const int SPI_CS = 2;

void setup() {
    pinMode (SPI_CS, OUTPUT);
    SPI.begin();
    SPI.setBitOrder(MSBFIRST);
    SPI.setFrequency(7280000);
}

void loop() {
    SPI.beginTransaction(spiSettings);
    digitalWrite (SPI_CS, LOW);

    uint8_t cmd = 0b11000000;
    byte msb, lsb;
    word assembled;

    msb = SPI.transfer(cmd);
    lsb = SPI.transfer(0);

    assembled = word(msb, lsb);
    Serial.println(assembled);

    digitalWrite (SPI_CS, HIGH);
    SPI.endTransaction();
}

Is there something wrong, or should something be added to this?

Try using a small delay between the transactions. An ADC need a bit of time to convert another value. The datasheet states, that is will clock out zeros indefinitely, when you continue to read (read chapter 5.1 in the datasheet. Last sentence in the left column). So I guess the CS pin is not long enough inactive

Ah, I will try that and read the data sheets!
But how does that explain that it works initially?

Maybe some weird racing condition, maybe something regarding how the sensor senses the CS pin

Thank you, I will try it a.s.a.p and come back here to add the results. This way others could use this as well.

Are you using a properly manufactured breakout board or just the bare chip on a breadboard?

@Majenko Properly manufactured, why?

Just wondering if you'd missed off the decoupling capacitors, but probably not if it's a BoB.

@Majenko, ah well its properly manufactured. But I designed the boards myselve (With capacitators) but maybe I am missing one. I will test chrisl s solution first. :-)

It is a good practice to set to Arduinos own Slave Select Pin (for UNO it's PIN 10) as an output. Because a signal on that pin could switch the Arduino to SPI Slave Mode. I do not believe it can fix your setting - but perhaps ... And you asked whether you missed something: pinMode (10, OUTPUT);

@chrisl It worked like a charm, Thanx! Can you post it as an answer, so I can accept it and people do not have to read the comments only?
The datasheet says:
'After completing the data transfer, if further clocks are applied with CS low, the A/D Converter will output zeros indefinitely. See
Figure 5-2 for details on obtaining LSB first data.'

I thin the following is happening:
The MCP transmits 1 measurement per SPI transaction, which consists of activating chip select, reading data and deactivating chip select. To distinguish between different transactions, the time between deactivation and reactivation of chip select need to have a bit delay between them. Currently your code runs really fast, a few microseconds between the transactions at max.
This may also be connected to the MCP needing time to measure the analog signal.
I think there is some kind of race condition, so that the MCP does not have a new value to transmit, either because the MCP hasn't finished measurement yet, or because the delay between the transactions were just a bit too short, maybe a combination of both.
When the MCP is once in this situation, it will only send zeros at that point  (read chapter 5.1 in the datasheet. Last sentence in the left column).
You need to give the MCP more time between the transactions. I suggest using a small delay at the end of the loop() function. You can experiment with the actual value, I would guess, that you can go down to the microseconds range.


text:
What power supply should I use?
I am building a robotic arm using 8 servo motors. I am wondering about what voltage my external power will need to be to control all of them at 6v. I am wanting to use a rechargeable battery.

I am wondering about what voltage my external power will need to be to control all of them at 6v

Well that would be 6V then wouldn't it?
You're asking the wrong question. The question you should be asking is:

How much current will I need from my 6V power supply?

And the answer is:
Add up the total current required by all of the devices and that is the minimum current the PSU has to provide
On top of that you need to consider how long the supply should last. The average current need to draw from the batteries, multiplied by the number of hours you need it to run for, is the minimum capacity of battery you need.
For instance, if you need to draw an average of 500mA for 6 hours then you need (0.5*6 =) 3Ah (or 3000mAh) batteries (or better).

It's not quite that simple as the loads will be highly variable, and the goal is a battery pack.  Fortunately, RC servos are designed to run on 4 NiCd cells, and those handle high temporary current from moving stalled servos pretty well.  So pack sizing is really more about how long it needs to work.  The question for the MCU is then a distinct supply, running it at 3.3v or so to leave headroom for dips under load, or a boost converter.

You may wish to consider how long youre using the rechargable battery. Basically ,since youre using rechargables you may want to consider how frequently you will need to recharge your batteries,  the more electrical power your using at once (e.g. every second)  the quicker your battery will run out and thus you may need to recharge it more.

You should use a Voltage Regulator for a stable Voltage Output.
First you should know your maximum Current consumption. Lets say for example maximum 2A.
You want the Voltage of the Servos stable, so they dont jerk around when there is a voltage drop or change. Because of this reason you should use a Voltage Regulator. For this example, choose one which has a Output of 6V 2A.
For the most of the Voltage Regulators you will be safe if you calculate an extra of 2V for the Voltage Drop. The Voltage Drop Value is specific for every Voltage Regulator Model. You can find this Value in its Datasheet.
So you would need a Power Source, for example a rechargeable NiMh battery with 8V(6V+2V), which can supply 2A. Not all batteries in the world will be able to give you 2A, but like all of the NiMh batteries should.
You can find the exact circuit for your Voltage Regulator in its Datasheet, which most likely also will have some (optional) capacitors in it.

In Summary:

Your needed Voltage (6V)
Your maximum needed Current (for example 2A)
Find one Voltage Regulator with 6V and 2A Output
Find out its Voltage Drop Value
6V + Voltage Drop Value = minimum battery voltage
Be sure the battery can support the maximum current (2A)
Design your circuit with the help of the Voltage Regulators Datasheet
Calculate if you need a heat sink for your Voltage Regulator

Actually RC servos are designed to run directly from an unregulated 4-cell battery pack, and they do not "jerk around" as a result - otherwise the planes would unintentionally.  That's the easy part.  The challenge is the arduino.

Am I missing something?-is he using RC (radio controlled servos) for a (air) plane - to make a robot arm?  It just says in the question hes using servos

Yes I am using an Mini Gear Micro 9g Servo Motor said to be for RC Helicopters, Airplanes, Cars, Boats, and Robots to make my robot arm. And  I am only wanting to be using the robot arm for around 10 minutes since I am not building the final project. @qwerty10

The servo motors' operating voltage is 3.0v~7.2v. @qwerty10


text:
Garbled serial from GPS device
I'm using an Arduino Uno. "Regular" serial is plugged into my computer, and I can receive just fine.
I'm using AltSoftSerial (tried SoftwareSerial, same results) with RX and TX on pins 8 and 9 to interface with a BR-355S4 GPS module. According to the data sheet on that module, the RX and TX are at 5v, which I believe is what the Arduino expects.
I combined the Serial and SoftwareSerial examples to test the connectivity from the Arduino to my PC and from the GPS to the arduino.
#include <AltSoftSerial.h>
AltSoftSerial altSerial;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(19200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  printAsciiTable();

  altSerial.begin(4800);
}

void printAsciiTable(){
  Serial.println("ASCII Table ~ Character Map");
  int thisByte;
  for(thisByte = 33; thisByte < 127; thisByte++){
    Serial.write(thisByte);
    Serial.print(", dec: ");
    Serial.print(thisByte);
    Serial.print(", hex: ");
    Serial.print(thisByte, HEX);
    Serial.print(", oct: ");
    Serial.print(thisByte, OCT);
    Serial.print(", bin: ");
    Serial.println(thisByte, BIN);
  }
  Serial.println("~~Done with ASCII Table~~");
}

void loop() {
  char c;
  if(altSerial.available()){
    c = altSerial.read();
    Serial.print(c);
  }
}

The data coming into the Serial Monitor tool looks fine until it starts pulling from the GPS serial stream (ellipses added by me):

...
  |, dec: 124, hex: 7C, oct: 174, bin: 1111100
  }, dec: 125, hex: 7D, oct: 175, bin: 1111101
  ~, dec: 126, hex: 7E, oct: 176, bin: 1111110
  ~~Done with ASCII Table~~
  4™5f3y=›ùÙ)É9Ó¦Ì™¦ ...

I would like to receive the correct NMEA strings from the GPS module on altSerial and push them out to Serial. The garbled nature of the serial data looks like a baud rate issue, but I've tried a handful of combinations for Serial and altSerial speed with no success. Any ideas?

In the comments I see that is not clear how you connect the module in your arduino.
The native mode is PS2 (old mouse and keyboard) you can use that directly with your arduino (PS2 protocol is 5v too), for this, you need implement a clock/data protocol.
If you use the rs-232 converter, notice that RS-232 as a amplitude from -12v ~ 12v this burn your arduino, so you need use a rs232-ttl converter.
Serial software are not a good choise, if you use that, save your data in a buffer and write only one time, in the end.

I looked up the datasheet and product specs for the GPS device. It says that the output is RS-232.
Note that RS-232 is NOT compatible with the Arduino levels. Arduino "talks and listens" at 5V or 3.3V depending on which board you're using.
So what you need is a RS-232-to-TTL converter. Now, TTL speaks Arduino. So Arduino will be able to understand that. So try using a MAX232 IC or a shield, whichever you're comfortable with.

This might be the case, but it also might not.  Can you say where you found the "datasheet" that lead you to conclude this?  Most of the information seems to be quite non-specific, so it's hard to be certain if the device itself uses RS232 signalling, or if they merely make a cable adapter available that converts between their undocumented proprietary signalling and proper RS232, just as they seem to make one which converters it for use with USB.

The model I bought is not using RS-232. Check the data sheet I linked in the initial question and search for "voltage," you'll see that it's using 5v for TX and RX.

I may have I jumped to a conclusion too quickly. The PS/2 to RS-232 cable set for PS/2 to RS232 conversion is what got me thinking. [link] http://usglobalsat.com/store/p-228-br305-rs232-rs232-cable-set.aspx#http://www.usglobalsat.com/images/product/large/228.jpg . You can see that the TX and RX pins go directly to the RS-232 connector. With not much info available in the "datasheet" I made the assumption that it uses RS-232. I apologize for not being too clear about how I came to the above answer.

No worries, @AjayPrabhu. Thank you very much for helping.

I spent some time looking around if anyone interfaced the same with arduino or any microcontroller. I found this project. You might want to take a look at this [link] (http://danceswithferrets.org/geekblog/?p=482). Hope this helps.

You can get 5V TTL USB serial adaptors. The classic being an FTDI one. Also you can get the MAX chip level converters as a tiny module, if you already have a normal RS232 adaptor. I would recommend connecting the GPS to your PC as a reality check. The garbled that you are seeing is typical Baud rate issues.
Also there can be polarity issues with the signal. (Not sure if you can switch the pin polarity of the Arduino in software.) So if you are connecting to a standard RS232 adaptor I think the MAX chips are available in inverting and none inverting versions.
Some PC RS232 adaptors are 5V tolerant. Google this for confirmation. You should just connect the GPS tx to the PC RX if you try this. (And 0V obviously.)


text:
Arduino SPI Communication with H3LIS100DL accelerometer
I'm having trouble getting information off the accelerometer I'm trying to use. What code should I use to read the X,Y, and Z axis?  I've read the data sheet but I don't have any experience with SPI communication.
Spec sheet

The basic SPI operations looks like this. First read single register:
uint8_t readRegister(int index)
{
  digitalWrite(CS, LOW);
  SPI.beginTransaction(SPI_SETTING);
  SPI.transfer(READ | index);
  uint8_t res = SPI.transfer(0);
  SPI.endTransaction();
  digitalWrite(CS, HIGH);
  return (res);
}

And second write single register:
void writeRegister(int index, uint8_t data)
{
  digitalWrite(CS, LOW);
  SPI.beginTransaction(SPI_SETTING);
  SPI.transfer(WRITE | index);
  SPI.transfer(data);
  SPI.endTransaction();
  digitalWrite(CS, HIGH);
}

Some more details:
const uint8_t WRITE = 0x00;
const uint8_t READ = 0x80;

It is also possible to read/write a sequence of registers by providing the register index with the MS set. This will auto-increment the register index.
SPI_SETTING is left as an exercise (to be updated).
Cheers!


text:
Sending IR via a wire
So i have taken apart this old remote i found, and removed the IR-LED and replaced it with wires.
I thought that i would just be able to put the wire that used to go to the positive side of the IR-LED, to a pin on my Arduino UNO (and negative to GND), and just use the same IR decoding library to decode the signal, as if it was from an IR sensor.
But as it turns out, i receive undecipherable nonsense (or so it seems), like 5+ different codes from pressing the same button on the remote.
If i connect the 2 pins from the remote to the IR-LED on my breadboard, and an IR receiver to my Arduino i receive the signal you would expect, which in my case is "24137D" in HEX (1 on the remote) every time.
So my question is: Why does this happen and is it even possible to do what i am trying to do. Why? Why not? And if possible how is this done?
Here is the code i am using:
#include <IRremote.h> //https://github.com/z3t0/Arduino-IRremote

#define IR_Pin 7

IRrecv irrecv(IR_Pin);
decode_results results;

void setup() {
  Serial.begin(9600);
  pinMode(IR_Pin, INPUT);
  irrecv.enableIRIn();

}

void loop() {
    if(irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    irrecv.resume();
  }

}

Maybe the answer is obvious and i just don't understand how IR works. If so feel free to link some documentation that can help me.
Thank you.

Do you have a 3-pin IR receiver?

@Majenko Yes i do (VS18388)

Your IR receiver is decoding the high frequency pulsed On-Off-Keying waveform for you. The Arduino doesn't do that.
An IR signal consists of high frequency (say 36KHz) on-off light pulsed at a lower (data) frequency (different combinations to make 1 and 0)

The receiver you have takes that high frequency signal, amplifies it, filters it, and gives you just the resulting 1 and 0 signals. From that the Arduino can use simple time measurements to work out the code.
Without the filtering that the receiver provides the Arduino will have to do all that work by itself - and while that may be technically possible, it's seldom done. You may be able to find a library that can do it, but it's unlikely.

Thank you for the quick response. Is there a fixed timing that i could simply implement like eg. delay(10) digitalRead(IR_Pin) //Repeat x times  and so on?

No. You would need to implement a system that triggered an interrupt on every rising edge, count the microseconds between each triggering, work out which is the leading and falling pulses of each block, and calculate the times between them all.


text:
Thunderstorm triggering button press?
So I recently built a small IFTT powered button using an ESP8266 for my boys to play with. Tonight during an intense Thunderstorm, I kept getting alerts that it had been pressed. They weren't in the basement at all. Then I realized, giant crack of lightening === SMS message.
Now I don't think this has anything to do with the button mechanism itself, but the shoddy way I hooked it up, and stuffed it into an enclosure. I'm just curious - is this possible? Could some sort of static electricity from a few nearby lightening strikes do something that would send a 'high' signal to the GPIO Pin on my Espee? I had to use a pull up resistor, and I feel like there's probably a few bare-ish wires in there, but nothing touching, or even close enough to 'arc'. Am I crazy?

You aren't crazy. I had a similar thing happen when an external hot-water system turned on at midnight (someone was having a shower) and one of my systems detected input unexpectedly (and rang a bell right next to my ear while I was trying to sleep).
My solution was to have something like this:

The diodes clamp the input to acceptable ranges, and R1 is a current limit for the diodes. R2 and C1 are a filter that slows down the incoming signal (and thus eliminates sudden spikes). R3 is a pull-up resistor. In my case I had active-low. If you have active-high you could use a pull-down resistor instead.
Also see https://arduino.stackexchange.com/a/13128/10794
Further reference material:

10 Ways to Destroy An Arduino
Protection
Microcontroller Input Protection Techniques


text:
Is possible to set a pin faster than digitalWrite?
I am currently using arduino library to logically set my digital pins high or low, but I just realized how slowly it actually sets those pins, which is especially problem as i am doing this in a ISR routine. Can't this be done faster by actually acessing the direct port, and setting the current pin?
How do I convert something like this
  digitalWrite(11, !digitalRead(11));

To something faster?
I am using a Arduino UNO..

Since pin 11 on the ATmega328P is PB3:
PINB |= _BV(PB3);

Yes there is!
You can directly manipulate the port. The Arduino website has a pretty good explanation for it here.
Togelling a pin as asked by you can be simply done by something like this:
  PORTB ^= _BV(PINNUMBER)

A simplified way is the digitalWriteFast library.

This library consists of a complex header file that translates digitalWriteFast, pinModeFast, digitalReadFast into the corresponding PORT commands. It provides syntax that is as novice-friendly as the arduino's pin manipulation commands but an order of magnitude faster.

The fastest way may be to use assembly from your C++ code:
asm volatile("SBI %[IOREG], %[BIT] \n\t"::[IOREG] "I" (&PINB), [BIT] "I" (PB3));

This forces a 1 to the bit for pin 11 (bit 3 on port B of the ATmega328), which, as per the Atmel datasheet, will simply toggle output (1 to 0 or 0 to 1) on that pin (provided it was initially setup as output).
As far as I remember the assemby instruction SBI used above cannot be generated by g++ (the C++ compiler used by Arduino IDE), hence you have to code it yourself.
You won't be able to achive a better performance as this single assembly instruction takes exactly 2 clock cycles to execute (ie 125 ns on an Arduino UNO).

You remember wrong. The answer from Ignacio Vazquez-Abrams compiles into the same assembly instruction.

Then that's very good news! Is that a change of latest arduino toolchain?

Seems gcc does that since at least 2002, but I don't know how much the Arduino toolchain is lagging behind gcc.

Yes that can be done by manipulating the ports directly. Here is the link to Arduino https://www.arduino.cc/en/Reference/PortManipulation

Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. Feel free to add a more complete answer that directly answers the question.

The Arduino GPIO library has been developed to allow high performance digital pin access. Most access functions are compiled to a single instruction and execute in 1-2 clock cycles. The library functions are more than 10 times faster than the Arduino digital pin functions. In some cases as much as 100 times faster.
Additional support classes are available for Shift Register Input/Output, and Software Serial. These also demonstrate how the GPIO template class may be used to construct additional libraries.
This library supports boards based on SAM3X8E, ATmega168, ATmega328P, ATmega32U4, ATmega1280, ATmega2560, ATtinyX4 and ATtinyX5.
The classical blink sketch looks like this:
GPIO<BOARD::D13> led;

void setup()
{
  led.output();
}

void loop()
{
  led = HIGH;
  delay(1000);
  led = LOW;
  delay(1000);
}

Please see github for benchmarks and further documentation and examples.


text:
Make a stepper motor move
I am at the moment trying to make a bipolar stepper motor move.
I am interfacing it through a control board, which takes the input Step, Dir, En, and 5V.
I am providing those input signal via an Arduino, but can't get the damn thing to move. all it does it move a step forward and backwards, like it being stuck or and tries to wiggle out of something.. What could the reason be..
Here is the Code:
#include "stepper_motor.h"
int max_step = 200;
stepper_motor::stepper_motor()
{
  pinMode(BUILTIN_LED,OUTPUT);
  pinMode(step_pin,OUTPUT);
  pinMode(dir_pin,OUTPUT);
  pinMode(en_pin,OUTPUT);

  alive_bool = true;
  position_bool = false;
  step_count = 0;
}

void stepper_motor::step_pwm()
{

  if(position_bool==true)
  {
    //Dir pin low
    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,LOW);

    delay(0.005);

    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,HIGH);

    delay(0.005);

    int step = 0;
    while(step < max_step)
    {
      digitalWrite(step_pin,HIGH);
      delay(1);
      digitalWrite(step_pin,LOW);
      delay(1);
    }

    //digitalWrite(en_pin,LOW);
    //position_bool = false;
  }
  else
  {
    //Dir pin high
    delay(1000);
    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,LOW);

    delay(0.005);

    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,LOW);
    digitalWrite(en_pin,HIGH);

    delay(0.005);

    digitalWrite(step_pin, LOW);
    digitalWrite(dir_pin,HIGH);
    digitalWrite(en_pin,HIGH);

    int step = 0;
    while(step < max_step)
    {
      digitalWrite(step_pin,HIGH);
      delay(1);
      digitalWrite(step_pin,LOW);
      delay(1);
    }

    //digitalWrite(en_pin,LOW);
    //position_bool = true;
  }

}

Updated step_pwm():
void stepper_motor::step_pwm()
{
    //Start -  En Low , DIR HIGH, STEP high
    //init configuration!
    digitalWrite(step_pin, HIGH);
    digitalWrite(dir_pin,HIGH);
    digitalWrite(en_pin,LOW); // Previous LOW

    delay(0.005);

    //T1-  En HIGH , DIR HIGH, STEP HIGH
    //Enable high
    //digitalWrite(step_pin, HIGH);
    //digitalWrite(dir_pin,HIGH);
    digitalWrite(en_pin,HIGH);

    delay(0.005);

    //T2-  En HIGH , DIR low, STEP HIGH
    //Direction choosen
    //digitalWrite(step_pin, HIGH);
    digitalWrite(dir_pin,LOW);
    //digitalWrite(en_pin,HIGH);

    delay(0.005);
    //T2-  En HIGH , DIR low, STEP HIGH
    //STEP  step between low and high with 2.5µs between

    while(1)
    {
      digitalWrite(step_pin,LOW);
      delay(2.5);
      digitalWrite(step_pin,HIGH);
      delay(2.5);
    }

}

The control board i am using is a ST330-v3
The motor i am using is this one
here is a little block diagram of how things are connected.

Your voltage is too low.

Its getting 12 volt, as required by the motor? and plenty of amp.. it is rated 1.2 A but the control board is capable of giving it 3 amp

I've posted an image of how things are connected..
I suspect it could have something to do with common ground?

It cannot be the common ground. I am only providing one ground signal... So it should not cause a problem.

"I am only providing one ground signal... So it should not cause a problem." No, that is your problem. You need to tie the Arduino ground to the driver board as well. As it stands, the driver has no way of knowing whether your inputs are high or low. The 5 volt connection does not suffice. In fact, the failure to provide a ground means that all the driver logic is unpowered. Consider this - would you expect your Arduino to work if you only connected its 5V, and not the ground?

So... you suggesting connect the negative terminal of the power with ground terminal of the arduino? Sorry for asking such a stupid question.. I am very much a noob when it comes to electronics.. Not at all my strong suit..

Doing above didn't not help..

Verify continuity in the two motor coils (multimeter). Reconnect and replace the Arduino with a debounced pushbutton driving the step input and tie EN and DIR to active and an arbitrary level respectively. Verify the voltages change across the coils sequentially.

Ok.. I will post an update code.. I made the motor move, but  only by removing the enable signal.  I accidentally pulled it out of the arduino and the system began to move. Then tried to remove the enable pin, and it changed direction.  But i can't codewise change the direction.. I guess this concludes that there isn't any wiring problem but the problem relies in the code..

Maybe your impression of which pin is enable and which is direction is swapped.  Best recheck everything with the most authoritative source documentation.  If the board documentation isn't great, get the IC data sheet and trace the connections to it.

I am using a wemos d1 mini.
The pin_mapping comes from this .h file
https://github.com/esp8266/Arduino/blob/master/variants/d1_mini/pins_arduino.h#L49-L61
If the mapping made above is incorrect, then would it explain alot of things

Well... It should not matter since i am using the arduino library.. So there implementation should still be there.

wauw... That sound like something that could make sense..
Anyway can I still could use the board someway, or would I have to use an arduino uno or something like that?

an uno does the same thing..

I am NOT sure  at all what what the solution is.. The ST330 seem like a bad design..?

You must set EN BEFORE you set DIR.  The datasheet says EN must be high for at least 5 microseconds before you set DIR.  You should probably just set EN high when your program starts, then not fool with it until your program ends.
The next thing is that I don't see you incrementing the variable "step" anywhere.  So, if you did get the stepper to turn, it wouldn't stop.

The updated code looks like it ought to work.
You should use DelayMicroseconds instead of Delay(0.005) though.  Delay takes an integer instead of a decimal value, so you won't get what you expect.  Curse the Arduino IDE for not throwing a fit when pass a float for an int.

It looks like anything working properly is purely luck.  The board you are using(NOT an Arduino) uses 3.3V logic levels.  The ST330 says a high must be at least 4V, so if it reacts to your control signals at all it is just luck.
The 8266 outputs are rated for 12mA, the ST330 inputs need about 20mA, so you are over doing it.  The 8266 might put up with, and might just die on you.
You might be able to drive the ST330 by switching the mode of the pins.
Low would be "set pin to mode output and set low."
A high would be "set mode input."
Input mode leaves the pin floating, which the ST330 will interpret as a high.
Other than that, you could use NPN transistors to drive the ST330 inputs, then invert your output signals.
The NPN would invert your signal (a high becomes a low) so you would have to set an output to low to get a high going into the ST330.

You can use NPN transistors like this to drive the ST330:

simulate this circuit – Schematic created using CircuitLab
Setting the  GPIO from the ESP8266 to high would cause a low on the ST330 input.
Setting the GPIO pin to low would cause a high on the ST330 input.
This is the solution I would prefer if I needed to use the ESP8266 with the ST330.

If you'd like to try a purely software solution, then do this:

To send a low to the ST330 input, set the GPIO to pin mode output and set the output to low. (pinMode(step_pin,INPUT) then DigitalWrite(step_pin,LOW))
To send a high to the ST330 input, set the pin mode to INPUT (pinMode(step_pin,INPUT)

When the GPIO pin is in input mode, it floats.  It doesn't have a voltage level of its own - it acts like it is disconnected.
If that works, I'd still prefer to use the transistors.

You can avoid all of this using the UNO.  It has 5V logic levels on the outputs.

It this based on the updated code or the prior?

The step variable is missing that is right, and it turned yes it didn't stop.  but the direction cannot be coded. what the mean by EN set before DIR is set.. isn't the case?

@BruceAbbott: I missed that while looking at the timing diagrams.  I'll change that part.

@CarltonBanks:  Based on the original code.  I'll take a look at what you've changed.

I understand the changes.. But is it what you had i mind..
I still have an issue with the thing only running when I use delay() and not delayMicroseconds(). The motor outputs a high pitch noise.

The high partand the low part of the pulse must each be at least 2.5 microseconds long.  The force the motor can generate is proportional to the pulse length.  Shorter is weaker.  If the pulses are too short, the motor can't move.  A quick look around the internet shows typical pulse rates in milliseconds range rather than in microseconds.

The change you made is pretty much what I meant.

Its just stated in the datasheet. But as mentioned the function only works with delay and not delayMicroseconds.

If you use DelayMicroseconds, then you would need a value of 2500 to get 2.5 milliseconds.

Regarding to your update..what do mean by switching of the pins? Could i use a uno instead? or what is the solution here?

And what is the solution you refer to.. I mean is an arduino uno able to provide this output

Are you sure about the input current... VM input current = 16 mA as max..

typical being 10 mA

Thanks for the last one..
I have an uno lying around, and if everything would work fine with the uno.. I would just transfer the code from the ESP to the uno..

Uno  made it work..
Thanks for the help

This is problematic:
 delay(0.005);

The Arduino delay() function takes an unsigned long as an input, which is an integer rather than floating point type.  As a result, the argument you pass to it will be treated as zero.  Depending on how delay() is implemented this will result in either no delay (beyond overhead), or a minimum that may be longer than you intended.
Of course you now seem to only be running this code once, and then going into an unending loop which uses a 2.5 ms delay that will, for the same reason, be more of a 2ms delay.

I am not sure i understand the answer.. I myself have wonderes why it works with the delay() and not delayMicroseconds() it seems a bit of.

You need to take time to understand the difference between integer and floating point types, otherwise any success will be little more than luck.

Ohh.. i understand the difference.. The only reason why i know it works is as you mention yourself. The code overhead. running delay(0) or delay(0.005) takes aprox. 12 µs which would have fulfilled the minimum required timeslot.


text:
Why is LED lid when pin is set low?
I made this simple piece of code, to make my LED flash.. Which it does when the pin is set low.. But how does that makes sense?
#include "pins_arduino.h"

void setup() {
  // put your setup code here, to run once:
  pinMode(BUILTIN_LED,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(BUILTIN_LED,LOW);
}

I am using the Wemos d1 - http://www.wemos.cc/

That depends entirely on how the LED is wired up. How have you wired your LED?

I am using a wemos d1

What's a wemos d1?

I am using this one http://www.wemos.cc/Products/d1_mini.html

I see no LED on the schematic. Do you mean the one built in to the ESP-12F module?

yes i am using the builtin led

If you can find a schematic of the internals of that proprietary module then you are a better man than me. But I will take an educated guess.

http://www.wemos.cc/Products/images/d1_mini.pdf
Schmatic

I said module. Not development board. The ESP-12F module. The silver can sub-circuit.

If the LED is ON when LOW and OFF when HIGH then chances are the LED is connected between +3.3V and the IO pin with a suitable resistor.
When HIGH the IO pin is at +3.3V, so the voltage across the LED is 0V (3.3 - 3.3 = 0) and it is turned off.  When LOW the IO pin is at (nearly) 0V and the voltage across the LED (and its resistor) is 3.3V (3.3 - 0 = 3.3), so it lights up.