Arduino controlled robot : without uploading every time - arduino

I've recently built an Arduino-controlled robot(4WD platform) using a beginner's kit.
After uploading compiled program into Arduino, I was able to get 4WD motors working.
But when I disconnect the USB cable after successful "uploading" and I turn on the mobile platform switch, it doesn't move a bit.
What procedure is required for getting it to move (I mean.. having machine language permanently stored in AVR microcontroller's memory) without again connecting USB cable to Arduino and uploading program after I find the code working so that just turning on the switch of the robot make it start to move as programmed?

It REALLY sounds like a power issue.
-What is powering your arduino when the USB is disconnected?
The USB from a computer is often pretty strong (hight current) and a 9V battery might not cut it for electric motors and such.
If this is the problem you may want to try a more powerfull battery setup, like 4 AAs.
You may go the LiPo battery route from a source like Adafruit or Sparkfun. Then the problem is that a LiPo battery only produces 3.3V. Ugh, you'll need an circuit to bump the voltage to 5 (which Adafruit sells) and a charger. This may be your best choice if you're planning to use the robot a lot.

Related

Platformio which ESP32 board to pick

Hello and happy holiday to all
I am using platformio for an arduino project for the first time. I have purchased this ESP32 borad:
EC Buying ESP32-DevKitC Development Board ,ESP32 Development Board Equipped with WROOM-32D Module Integrated WiFi Bluetooth Module Microprocessor Interface SPI I2C I2S Suitable for Arduino
I am new to all this and need to know what board I should pick in PLATFORMIO for this board. I have loaded the core 32 from Espressif 32 and have the large list of ESP32 boards.
just want to make sure to pick the correct board to match the one purchased. Here is also the link to amazon on the board purchased.
https://www.amazon.com/dp/B0B64SD16T?psc=1&ref=ppx_yo2ov_dt_b_product_details
Thanks to all you wonderful people who can help.
I have not tried any boards listed as I did not what to damage this new board.
You won't damage an ESP32 by choosing the wrong PlatformIO board. The worst that will happen is that you won't be able to flash your program to the board, or it won't run correctly when it's flashed. While it's not impossible to brick an ESP32 by configuring security options, that's not something PlatformIO is going accidentally do to your board.
You can search the list of available boards on the web and look for a close match.
The most important thing is to get the correct processor type - figure out whether you have ESP32, ESP32-S2, ESP32-S3, ESP32-C3 (or eventually some other kind of ESP32). Only consider PlatformIO boards for that specific CPU. Then look for the size of the flash storage. Usually any board that matches that spec will work.
esptool.py, the program PlatformIO uses to flash the firmware to the board, will detect the CPU type, so if you have an ESP32-S2 and try to flash code for an ESP32 to it, it will detect this and report an error.
In your case you might try the generic Espressif ESP32 Dev Module:
[env:esp32dev]
platform = espressif32
board = esp32dev
If your first try doesn't work, it's safe to try another.

Arduino - Sparkfun USB host

I am building a device and need to use a USB Nordic ID rfid reader. I have a Spark-fun USB host card (V9947), and now need the firmware to allow be bi directional chat in a 'rs232' style serial... just as if it were a hardware or software serial port on the Arduino.
Nordic support have reassured me that their library and examples for the Arduino are normally used with readers with RS232 ports, however the same code will work with their smaller USB device if I can overcome the USB/serial barrier.
I have the library and examples for the USB host board, but cannot determine which example code resembles my requirement requirement, I have looked through the library and found no answer there either.
This could be down to personal stupidity/ignorance... however never been this stumped before. the internet does not seem to have an answer, documentation and support for this board are at best meager.
I hope someone here has managed to solve what should be a simple mission, and I can get on with this project.
Thanks Ian
As not knowing what you already have done, I'll make a walk through the complete setup. Please check(do) each point evenif you think its done already:
Soldering and hardware have no shorts
pin headers of the shield are soldered with no shorts
USB Jack of Arduino is isolated on the top to prevent shorts
With the SparkFun board, it seems like you MUST supply external power on Vin or the barrel jack. 5V from the USB cable will not work reliable.
You must also run a jumper from pin D7 to RESET.
For the board (SparkFun DEV-09947) set up – these are mandatory pre-requirements.Now the software
The code/drivers you need to use for this board are on this GitHub page.
There is a diagnostic test which is extremely useful for checking wether your board is working correctly. Do as follows:
Upload this sketch to your Arduino, then open the Serial Monitor to see the diagnostic info.
To see the output set your Serial Monitor terminal speed to 115200
Plug in your hardware into the USB of the shield
Reset the Arduino to start the diagnostic
Step 1 – you’ll see it recognize the board and start a transfer test
Step 2 – you’ll see it attempt to test the GPIO pins – you’ll get “GPIO test failed” message. Type something in the box at the top of the Serial Monitor, then hit “Send” button and the diagnostic test will continue.
Step 3 – you should see it cycle through a bunch of resets, then it will attempt to detect an USB device – as we have a device plugged into the USB port on the shield you should then see some summary info with a final message of “All tests passed”
So NOW we know the hardware is working and basic software is running.
Next step driver installation/test program for the Nordic
Get the library from here
Import NurMicroApi_arduino.zip to IDE. From menu: Sketch->Include library->Add .ZIP library...
Open example. From menu: File->Examples->NurMicroApi->NurExample
Change baudrates and sw serial pins to match your arduino HW In this example NUR module is connected to arduino via software serial pin 10 (RX) and pin 11 (TX) with baudrate 38400. HW serial is used as print output.
You may have to change this to the USB card connections (see diag-SW)
As an easier option you can use the HID parser to check if your NUR is recognized If that works take a working exmple like:
Working HID example and try to read a tag then start coding with the NUR example from above if values are not correct interpreted
If you want to use the "pure" at-Terminal (RS-232) style you have to get rid of the usb shields functions (lib) and write your own Arduino firmware based (=overcome the USB/serial barrier) on the nordic-api (well documented) Hope this gets you started

BadUSB with atmega328P instead of 32U4? Is it possible?

Where I live I can’t really get my hands on an arduino pro micro without waiting an extensive amount of time for the delivery. Can I by any chance use an arduino nano for the job without having to buy a seperate usb compatibility chip?
The nano and uses the 328p, not 32u4.
The 32u4 makes it easier to make USB/MIDI devices though.
(It's possible to achieve this with a 328p as well, just not as trivial)
Pick the board that makes most sense in terms of your project requirements.
You won't have to buy a separate chip for USB/Serial conversion,
you'll need a mini USB for the Nano instead of micro USB cable (used for the Pro Micro)

avrdude : stk500_getsync not in sync:resp=0x87

I am using arduino uno r3 board and arduino 1.6.5 on windows 8. When Itried to upload my program on ATMEGA328 microcontroller it is showing:
avrdude:stk500_getsync not in sync:resp=0x87.
help me to solve this error
This boils down to 3 problems usually..
The bootload on the chip is missing (unlikely if you purchased the board from Arduino).
The serial connection between the arduino and the computer is disconnected or interrupted.
You've simply selected the wrong board type or port when programming, and thus the IDE is searching for a signal that the arduino isn't coming back with.
This problem is most likely due to option 3, however it can occur in odd situations especially on the Arduino Micro where the board does all USB comms on chip and can be flooded by main without an appropriate delay to the point it can't communicate with the IDE. However this is just most likely a bad board selection or a bad port selection.
I've tried many things but this worked for me. If you have a working Arduino lying around (in my case Uno) you can use it as an intermediate in-system programmer (ISP).
Follow this guide to first load the ISP sketch into your working Arduino.
Once you are done, for your non-working Arduino, select from the Tools > Programmer menu and choose Arduino as ISP, and set Board and Processor accordingly. To program choose Sketch > Upload using programmer.
Hope this works.
I think the reason that this work is that it will bypass the CH340/FTDI chip, and all those synchronization issue. Given that that is your problem.

Cant upload a boot loader to arduino

Using arduino UNO(mac) i am trying to upload boot loader to the atmega328 where the chip is on a bread board, and connected to the UNO board tx-tx, rx-rx, vcc,gnd ,reset .
So i am trying to upload a boot loader by adding to the boards.txt file the atmega on a breadboard 8mhz , and choose it from boards menu.
than when i try to burn boot loader he says after 0 seconds :
did not find any USB device "usb"
than i change the programmer from - AVR ISP mkii to- AVR ISP
it starts then, and after 6-7 seconds of try he fails saying:
programmer is not responding
I dont know what am i doing wrong, i have also tried with a oscillator,or without it, nothing works.
maybe the fact that its a mac has todo with it ?
To access that portion of memory you need to use the arduino as an ISP (in-system programmer).
The use of USB to program an arduino chip is enabled by the bootloader you are trying to put on.
The usual way is to program a chip directly is using an ISP.
Have a look at the setup here:
http://arduino.cc/en/Tutorial/ArduinoISP
Another good resource for an advanced build is this:
How to Build an AVR Development Board: http://youtu.be/ncobWc61wL4
He explains what he is doing as he goes so it is really easy to follow and he talks about the programming process.

Resources