Open hardware doesn't work as expected

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Greetings gentleman. 

 

I would really appreciate a piece of advice what should I do in this situation: 

 

I have built open hardware device which is a servo trigger using the files provided by Sparkfun

 

Project page is here: https://www.sparkfun.com/product...

 

I have used this firmware: https://github.com/sparkfun/Serv...

 

The problem is  - it's not working properly. When I plugin the power, the servo connected to it starts going in one direction, whereas it should only travel if the button is pushed. It keeps going and never stops, irregardless of button state or trimpot adjustments. I have tried different power sources and servo models - but the result is always the same - servo keeps going in one direction.

 

 

I have purchased the following parts.

 

1. Cap Tant Solid 10uF 6.3V A CASE 10% (3.2 X 1.6 X 1.6mm) Inward L SMD 3216-18 4 Ohm 125°C Automotive T/R

 

2. Ceramic Resonator 16MHz ±0.5% (Tol) ±0.15% (Stability) 15pF 40Ohm Automotive 3-Pin CSMD T/R

 

3. Cap Ceramic 0.1uF 6.3V X7R 10% Pad SMD 0603 125°C T/R

 

4. MCU 8-bit AVR RISC 8KB Flash 2.5V/3.3V/5V 14-Pin SOIC W Tube

 

5. Res Thick Film 0603 10K Ohm 1% 0.1W(1/10W) ±100ppm/°C Pad SMD T/R

 

6. 3314G-1-103E 10K trimpots

 

I have purchased 6.3 Volts parts because I will never use more than 5 Volts power source. I have also purhased Attiny84A instead of Attiny84. Could it be the problem? 

 

 

I have assembled everything like on the photo and didn't solder any jumpers on the back of the board. 

 

For programming part - I tried to use different software - Atmel Studio 7 and AVRDUDESHELL and the result is the same. My programmer is USBASP  

 

USBASP programmer was configured with the following arguments: 

 

avrdude -c usbasp -p t84 -U lfuse:w:0x7f:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i

 

I have used Attiny84 as part number. Should I use Attiny84A instead? And do I need to change anything in the project then? 

 

I opened the project and the software offerred to convert it to Atmel 7 format. Then I set up the settings like on the attached screenshots. 

 

Then I built this project and got the following reply: 

------ Build started: Project: ServoTrigger_6_2, Configuration: Debug AVR ------
Build started.
Project "ServoTrigger_6_2.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\Thornton\Desktop\Servo_Trigger-HW_10_FW_10\Firmware\ServoTrigger\ServoTrigger_6_2.cproj" (target "Build" depends on it):
    Task "RunCompilerTask"
        Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
        C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 6 --output-sync
        make: Nothing to be done for 'all'.
    Done executing task "RunCompilerTask".
    Task "RunOutputFileVerifyTask"
                Program Memory Usage     :    1684 bytes   20,6 % Full
                Data Memory Usage         :    59 bytes   11,5 % Full
    Done executing task "RunOutputFileVerifyTask".
Done building target "CoreBuild" in project "ServoTrigger_6_2.cproj".
Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').
Target "Build" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Avr.common.targets" from project "C:\Users\Thornton\Desktop\Servo_Trigger-HW_10_FW_10\Firmware\ServoTrigger\ServoTrigger_6_2.cproj" (entry point):
Done building target "Build" in project "ServoTrigger_6_2.cproj".
Done building project "ServoTrigger_6_2.cproj".

Build succeeded.

 

After that I flashed the microcontroller and got the following reply: 

 

 

avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude.exe: Device signature = 0x1e930c
avrdude.exe: NOTE: FLASH memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: erasing chip
avrdude.exe: warning: cannot set sck period. please check for usbasp firmware update.
avrdude.exe: reading input file "0x7f"
avrdude.exe: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude.exe: 1 bytes of lfuse written
avrdude.exe: verifying lfuse memory against 0x7f:
avrdude.exe: load data lfuse data from input file 0x7f:
avrdude.exe: input file 0x7f contains 1 bytes
avrdude.exe: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude.exe: verifying ...
avrdude.exe: 1 bytes of lfuse verified
avrdude.exe: reading input file "0xdf"
avrdude.exe: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude.exe: 1 bytes of hfuse written
avrdude.exe: verifying hfuse memory against 0xdf:
avrdude.exe: load data hfuse data from input file 0xdf:
avrdude.exe: input file 0xdf contains 1 bytes
avrdude.exe: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.00s

avrdude.exe: verifying ...
avrdude.exe: 1 bytes of hfuse verified
avrdude.exe: reading input file "0xff"
avrdude.exe: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude.exe: 1 bytes of efuse written
avrdude.exe: verifying efuse memory against 0xff:
avrdude.exe: load data efuse data from input file 0xff:
avrdude.exe: input file 0xff contains 1 bytes
avrdude.exe: reading on-chip efuse data:

Reading | ################################################## | 100% 0.00s

avrdude.exe: verifying ...
avrdude.exe: 1 bytes of efuse verified
avrdude.exe: reading input file "C:\Users\Thornton\Desktop\Servo_Trigger-HW_10_FW_10\Firmware\ServoTrigger\Debug\ServoTrigger_6_2.hex"
avrdude.exe: writing flash (1684 bytes):

Writing | ################################################## | 100% 1.04s

avrdude.exe: 1684 bytes of flash written
avrdude.exe: verifying flash memory against C:\Users\Thornton\Desktop\Servo_Trigger-HW_10_FW_10\Firmware\ServoTrigger\Debug\ServoTrigger_6_2.hex:
avrdude.exe: load data flash data from input file C:\Users\Thornton\Desktop\Servo_Trigger-HW_10_FW_10\Firmware\ServoTrigger\Debug\ServoTrigger_6_2.hex:
avrdude.exe: input file C:\Users\Thornton\Desktop\Servo_Trigger-HW_10_FW_10\Firmware\ServoTrigger\Debug\ServoTrigger_6_2.hex contains 1684 bytes
avrdude.exe: reading on-chip flash data:

Reading | ################################################## | 100% 0.79s

avrdude.exe: verifying ...
avrdude.exe: 1684 bytes of flash verified

avrdude.exe: safemode: Fuses OK

avrdude.exe done.  Thank you.

 

I have tried to flash 3 boards - and the result is the same - when I plug in the servo, it keeps moving in one direction and doesn't stop.

 

I am stuck. What should I do in this case? Start checking parts by multimeter? Or use oscilloscope to measure PWM ? I would really appreciate your advice, at least how to check.

 

Thank you very much in advance.

 

Last Edited: Sun. Nov 12, 2017 - 10:29 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would really appreciate a piece of advice

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Project page is here:

Where?

 

I have used this firmware: 

What firmware?

 

No links shown, maybe the spam filter knocked them out.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Mon. Nov 6, 2017 - 08:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would first check the output of the 3 pots, using a voltmeter, measure the center terminal to gnd.   Using a screwdriver, adjust each pot and verify they output a 0-5v signal as expected.

 

Jim

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The build output that you show has this in it:

 

        make: Nothing to be done for 'all'.

 

This reveals that the build found everything up-to-date and thus not a single file was recompiled or  linked. Thus we can not see the actual compilation and linking commands and can not verify that they seem OK.

 

Please do a Rebuild (equivalent of a Clean followed by a Build) and show the output of that.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I went over to Sparkfun and found that there are two different servo trigger products. One of those is a "continuous rotation" variant. Did you mix them up, buying the wrong board or using the wrong software?

 

Note that Sparkfuns Github repo for this contains pre-built hex files to burn to the AVR flash. It seems you don't even need to build the firmware yourself if you just want to test the board, or don't want to change anything in the firmware.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, having an O'scope to look at the servo drive signal will help tremendously.

 

If that isn't an option, then hook up an LED and a 330  or 470 ohm series resistor to one of the I/O pins, such as "ModeSelect", and flash an LED at 1 Hz.

 

This will tell you if the micro is truly running at 16 MHz or not.

 

If the Fuses are not set correctly for 16 MHz then the servo drive signal will be way off, and it won't work.

 

Once it works you could also improve the design by putting a small, 0.1 uF cap, from the wiper of each of the three pots to Ground.

That, however, isn't why the project isn't working.

 

JC

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gentlemen, thank you very much for trying to help. I didn't expect such a warm attitude. 

 

The project page is: https://www.sparkfun.com/product...

 

There is a documents section and firmware on github page: https://github.com/sparkfun/Serv...

 

I have used exactly the same firmware and board. 

 

The version with continuous rotation has 'continious' word in its name. 

 

I have tested trimpots and they show 0 to 5.11 volts depending on adjustments.

 

When I rebuild the project I get 0 errors, just one warning about unused 'edge' variable. 

 

Here is the output when I rebuild: 

 

------ Rebuild All started: Project: ServoTrigger, Configuration: Debug AVR ------
Build started.
Project "ServoTrigger.cproj" (Clean target(s)):
Target "Clean" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\Thornton\Desktop\Servo_Trigger-master\Firmware\ServoTrigger\ServoTrigger.cproj" (entry point):
	Task "RunCompilerTask"
		Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
		C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe clean 
		rm -rf  ServoTrigger.o   
		rm -rf  ServoTrigger.d   
		rm -rf "ServoTrigger.elf" "ServoTrigger.a" "ServoTrigger.hex" "ServoTrigger.lss" "ServoTrigger.eep" "ServoTrigger.map" "ServoTrigger.srec" "ServoTrigger.usersignatures"
	Done executing task "RunCompilerTask".
Done building target "Clean" in project "ServoTrigger.cproj".
Done building project "ServoTrigger.cproj".

Build succeeded.
------ Rebuild All started: Project: ServoTrigger, Configuration: Debug AVR ------
Build started.
Project "ServoTrigger.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\Thornton\Desktop\Servo_Trigger-master\Firmware\ServoTrigger\ServoTrigger.cproj" (target "Build" depends on it):
	Task "RunCompilerTask"
		Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
		C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 6 --output-sync 
		Building file: .././ServoTrigger.c
		Invoking: AVR/GNU C Compiler : 4.3.3
		"C:\WinAVR-20100110\bin\avr-gcc.exe"  -x c -funsigned-char -funsigned-bitfields -DFSMA=bistableFSM -DFSMB=oneshotFSM -DDEBUG -DSAFERANGE  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATtiny_DFP\1.2.118\include"  -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -g2 -dD -Wall  -mmcu=attiny84  -c -std=gnu99 -MD -MP -MF "ServoTrigger.d" -MT"ServoTrigger.d" -MT"ServoTrigger.o"   -o "ServoTrigger.o" ".././ServoTrigger.c" 
		Finished building: .././ServoTrigger.c
		.././ServoTrigger.c: In function 'astableFSM':
C:\Users\Thornton\Desktop\Servo_Trigger-master\Firmware\ServoTrigger\ServoTrigger.c(659,1): warning: unused variable 'edge'
		Building target: ServoTrigger.elf
		Invoking: AVR/GNU Linker : 4.3.3
		"C:\WinAVR-20100110\bin\avr-gcc.exe" -o ServoTrigger.elf  ServoTrigger.o   -Wl,-Map="ServoTrigger.map" -Wl,--start-group -Wl,-lm  -Wl,--end-group -Wl,--gc-sections  -mmcu=attiny84   
		Finished building target: ServoTrigger.elf
		"C:\WinAVR-20100110\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures  "ServoTrigger.elf" "ServoTrigger.hex"
		"C:\WinAVR-20100110\bin\avr-objcopy.exe" -j .eeprom  --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0  --no-change-warnings -O ihex "ServoTrigger.elf" "ServoTrigger.eep" || exit 0
		"C:\WinAVR-20100110\bin\avr-objdump.exe" -h -S "ServoTrigger.elf" > "ServoTrigger.lss"
		"C:\WinAVR-20100110\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "ServoTrigger.elf" "ServoTrigger.srec"
		"C:\WinAVR-20100110\bin\avr-size.exe" "ServoTrigger.elf"
		   text	   data	    bss	    dec	    hex	filename
		   1650	     34	     25	   1709	    6ad	ServoTrigger.elf
	Done executing task "RunCompilerTask".
	Task "RunOutputFileVerifyTask"
				Program Memory Usage 	:	1684 bytes   20,6 % Full
				Data Memory Usage 		:	59 bytes   11,5 % Full
	Done executing task "RunOutputFileVerifyTask".
Done building target "CoreBuild" in project "ServoTrigger.cproj".
Target "PostBuildEvent" skipped, due to false condition; ('$(PostBuildEvent)' != '') was evaluated as ('' != '').
Target "Build" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Avr.common.targets" from project "C:\Users\Thornton\Desktop\Servo_Trigger-master\Firmware\ServoTrigger\ServoTrigger.cproj" (entry point):
Done building target "Build" in project "ServoTrigger.cproj".
Done building project "ServoTrigger.cproj".

Build succeeded.
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

There are a few things I have noticed about fuses - the fuses in the project are set to use external resonator, but it's also set to divide the clock frequency by 2 internally. I have read in their blog that they use the same components for many other projects, perhaps it's the reason for using 16Mhz resonator in this project, although it's not necessary here if fuses are set up to divide clock internally. 

 

I haven't tested the output signal using the O scope, I will measure as soon as I have it. 

 

Regarding ready made hex files - I wasn't able to find them in the project folder, so I had to use atmel studio to compile. 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have measured the signal on servo signal pin and on the microcontroller pin. The result is on the photo. It doesn't change irregardless of button state: 

 

 

Can someone tell if it's a good signal for driving the servo? I have seen the video on youtube and one part is stretching when servo moves. But not in my case - the signal remains still. 

Last Edited: Tue. Nov 14, 2017 - 11:11 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The board is supposed to generate a 1 to 2 ms pulse every 20ms - you scope shows about a 1.5ms pulse, so the micro is working. The level seems a little low at 3V. The servo may not like this. How are you powering the board?
Have you checked the connections from the switch to the micro? A broken track will ruin your day.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I powered it with 3 volts power source - but on 5 volts I get the same result. The problem in this case - servo should start moving only when the button is pressed, instead it starts moving when the power is connected. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MegaBlackJoe wrote:
I powered it with 3 volts power source - but on 5 volts I get the same result. The problem in this case - [..] it starts moving when the power is connected. 

In which of the cases does it start moving? Only 5 Volts or both?

 

Show scope trace for 5 Volt case. If your scope has two channels: Put second probe/channel on power supply.

 

What are you using as a power supply in the 5 volt case?

 

Tell us which make and model of servo you are using. Web link if possible..

 

Take photo clearly showing connections between board and servo, and also the power supply lines to the servo.

 

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps the servo is OK with the 3 V signal, and the servo moves when you turn on the power because the 1.5 mSec pulse is telling the servo to center itself.

 

The servo won't move when yo push the button because the pulse width isn't changing.

1 mSec = far left.

2 mSec = far right.

1.5 mSEc = the middle, where it is stationary because the pulse width is fixed.

 

Regardless of the power supply issues, there is still a software issue.

 

JC